show tick label long lat

8 ビュー (過去 30 日間)
Den
Den 2022 年 10 月 8 日
コメント済み: Den 2022 年 10 月 9 日
please, i'm try to plotting total precipitation map. this is my code
ncfile = 'total_precipitation.nc';
%% to read a variable 'var' exisiting in nc file
lon = ncread(ncfile,'lon');
lat = ncread(ncfile,'lat');
tpp] = ncread(ncfile,'tp');
% plot figure
figure
imagescn(lon,lat,tp);
colormap jet
axis image
caxis([0 30])
grid on
set(gca,'GridLineStyle',':')
ax=gca;
ax.FontSize = 7;
ax.GridAlpha=0.5;
% add border
borders('countries','facecolor','r','FaceAlpha',.3,'EdgeAlpha',.3)
%% Indonesia
x1 = 90;
x2 = 150;
y1 = -12;
y2 = 10;
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% set grid
tickValues = x1:10:x2;
set(gca,'XTick',tickValues,'GridLineStyle','--');
tickValues = y1:3:y2;
set(gca,'YTick',tickValues,'GridLineStyle','--');
% Zoom in:
axis([x1 x2 y1 y2]);
and here is the result
but what i want is to show degree of the longitude and latitude like this one,

採用された回答

Walter Roberson
Walter Roberson 2022 年 10 月 8 日
If your longitudes will never be negative (west) then you can use https://www.mathworks.com/help/matlab/ref/xtickformat.html
xtickformat('%d° E')
  1 件のコメント
Den
Den 2022 年 10 月 9 日
thanks @Walter Roberson, its really helps. but how to use if i have negative value like in my latitude?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by