labelling longitude/latitude of pcolor worldmap

2 views (last 30 days)
anne d.
anne d. on 14 Jul 2015
Edited: ag on 5 Nov 2024
hey, i have created a pcolor world map and i would like to label the longitude and latitude in that way: longitude (5o degree east, 150 degree east, 110 degree west) and the latitude (80 degree south, 40 degree south,0degree, 40 degree north, 80 degree north). how can i do this? can somebody help me with a code? that would be great!!

Answers (1)

ag
ag on 5 Nov 2024
Edited: ag on 5 Nov 2024
Hi Anne,
To label the longitude and latitude on a "pcolor" plot in MATLAB with specific labels like "5° East," "150° East," "110° West," and so on, you can customize the tick labels of the axes. Here's how you can achieve this:
  1. Set the tick positions for both the x-axis (longitude) and y-axis (latitude).
  2. Customize the tick labels to display the desired text.
The below code snippet demonstrates the above steps:
% Set the tick positions
xticks([-110, 5, 150]);
yticks([-80, -40, 0, 40, 80]);
% Set the tick labels
xticklabels({'110° West', '5° East', '150° East'});
yticklabels({'80° South', '40° South', '0°', '40° North', '80° North'});
For more details, please refer to the following MathWorks documentations:
Hope this helps!

Community Treasure Hunt

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

Start Hunting!