MATLAB Answers

Add 0.5 *0.5 degree grid on figure (country)

14 views (last 30 days)
Behzad Navidi
Behzad Navidi on 16 Jan 2020 at 16:23
Answered: Star Strider on 16 Jan 2020 at 17:15
Hey all, I was even read grid function documentation here: https://www.mathworks.com/help/matlab/ref/grid.html
But I don't know how to set 0.5 degrees * 0.5-degree grids on the country ?!
this code below although gives me grided figure but not in 0.5*0.5 degree
borders('Iran Islamic Republic of')
grid on
ax.GridLineStyle = '-';
the output is:
Capture.JPG
you can see it is not in 0.5*0.5 degree format and it's look like it is in 5 * 2 degree!
Thank you all

  0 Comments

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 16 Jan 2020 at 17:15
This illustrates the general approach:
x = linspace(44, 64);
y = linspace(25, 40);
t = linspace(0,2*pi);
circx = 0.25*(max(x)-min(x))*cos(t)+min(x);
circy = 0.25*(max(y)-min(y))*sin(t)+min(y);
figure
plot(circx, circy)
xt = get(gca, 'XTick');
set(gca, 'XTick',round(linspace(min(xt),max(xt),2*numel(xt)-1),1), 'XTickLabel',round(linspace(min(xt),max(xt),2*numel(xt)-1),1))
yt = get(gca, 'YTick');
set(gca, 'YTick',round(linspace(min(yt),max(yt),2*numel(yt)-1),1), 'YTickLabel',round(linspace(min(yt),max(yt),2*numel(yt)-1),1))
I do not have the map coordinates, so I cannot reproduce the plot.

  0 Comments

Sign in to comment.

More Answers (1)

Spencer Chen
Spencer Chen on 16 Jan 2020 at 16:51
You can set the XTick and YTick properties of the axis.
Blessings,
Spencer

  0 Comments

Sign in to comment.

Sign in to answer this question.

Tags