Add 0.5 *0.5 degree grid on figure (country)

1 回表示 (過去 30 日間)
BN
BN 2020 年 1 月 16 日
回答済み: Star Strider 2020 年 1 月 16 日
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

採用された回答

Star Strider
Star Strider 2020 年 1 月 16 日
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.

その他の回答 (1 件)

Spencer Chen
Spencer Chen 2020 年 1 月 16 日
You can set the XTick and YTick properties of the axis.
Blessings,
Spencer

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by