Axis Labels/Tick Marks for surfm plot
Show older comments
Here is my working code to generate a 4 panel plot of northern hemisphere seasonal wind speeds with a map in the background using Matlab 2015a:
lat = linspace(0, 90, size(Vwin,1));
lon = linspace(-180, 180, size(Vwin,2));
data = {Vwin, Vspr, Vsum, Vfal};
Title = {'\fontsize{23} \bf NHFT Mean Merid Winter Wind Speed';
'\fontsize{23} \bf NHFT Mean Merid Spring Wind Speed';
'\fontsize{23} \bf NHFT Mean Merid Summer Wind Speed';
'\fontsize{23} \bf NHFT Mean Merid Fall Wind Speed'};
coast = load('coast');
figure;
for ii = 1:4
ax(ii) = axes('position', pos(ii,:));
axesm('eqdcylin','origin',[0 270 0],'MapLatLimit',[0 90]);
gridm on;
surfm(lat, lon, data{ii},'EdgeColor','none'); colormap(jet);
caxis([-8,8]); set(gca,'FontSize',17);
geoshow(coast, 'color', 'k');
tightmap;
title(Title{ii});
xlabel('\fontsize{20} \bf Longitude');
ylabel('\fontsize{20} \bf Latitude');
end
Here is what I had used previously to define grid axis ticks and labels of a surf plot:
set(gca,'xlim',[1 180]); set(gca,'XTick',(1:10:180)); set(gca,'XtickLabel',(-180:20:180));
set(gca,'ylim',[1 46]); set(gca,'YTick',(1:5:46)); set(gca,'YtickLabel',(0:10:90));
When I plug this directly into the loop, it labels the axes correctly but doesn't show the data or map correctly. Alternatively, using setm(gca ....) gives me the error below. Thus, I am unsure how to properly assign axis ticks or labels to a surfm plot.
Error using setm>verifyAxesChildren (line 399)
There is data in an hggroup that cannot be reprojected.
Error in setmasetmaxes (line 111)
verifyAxesChildren(ax, oldstruct, varargin{:});
Error in setm (line 49)
setmaxes(varargin{:});
Error in Map (line 40)
setm(gca,'xlim',[1 180]); set(gca,'XTick',(1:10:180)); set(gca,'XtickLabel',(-180:20:180));
Thank you very much, Evan Kutta
1 Comment
Evan Kutta
on 22 Aug 2015
Accepted Answer
More Answers (1)
dpb
on 23 Aug 2015
0 votes
I don't have the Toolbox so can't 'spearmint but it appears from your link there is no 'x|ytick' property for the specific object but following thru the maze from setm documents to the properties pages leads you (eventually) to http://www.mathworks.com/help/map/ref/axesm.html#f12-65627 which looks like they're called 'M|PLineXXXX' properties for meridian and parallel axes, respectively.
Categories
Find more on Axis Labels in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!