How to adjust x-axis in a plot?
12 ビュー (過去 30 日間)
I am trying to plot a global picture (as shown in figure attached) where my x-axis is from 180 to -180 longitudes but I need to adjust it to start from 0 longitudes and and end with just before 0 longitudes (a sample is also shown).
Please suggest how to achieve that?
How I want:
ANKUR KUMAR 2021 年 8 月 20 日
編集済み: ANKUR KUMAR 2021 年 8 月 23 日
You can use circshift to rotate your data in a circular fashion. Once you have the circular shifted data, you can just manipulate the coastlon to get the longitudenal range starting from 0 to 360.
Here is an example using reanalysis data.
file='gdas.txt'; % this is really a netcdf data,
% %but I have changed just the file extension to attach this file here in the answers
contourf(lon, lat, tmp', 'linecolor','none')
plot(coastlon, coastlat, 'k-','LineWidth',0.2)
coastlon(abs(diff(coastlon))>100)=nan; % commenting this line results into mutiple
% horizontal lines in the plot
contourf(lon, lat, circshift(tmp,size(lon,1)/2,1)', 'linecolor','none')
plot(coastlon-180, coastlat, 'k-','LineWidth',0.2)
その他の回答 (2 件)
KSSV 2021 年 8 月 20 日
To limit axes read about xlim, ylim, axis.
To put up your required lables on the axis read about xticklabel and yticklabel.
Steven Lord 2021 年 8 月 20 日
Since you're working with map data, you may want to explore the map axes that is part of Mapping Toolbox if this toolbox is available to you. There are a number of properties of map axes that you can control (including projection as well as longitude and latitude limits) that may be of use to you in creating this map graphic.