I have a feeling this page in the documentation might have the answer, but I am not exactly sure. Accessing and Manipulating Map Axes Properties
Axis Labels/Tick Marks for surfm plot
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
Réponse acceptée
Evan Kutta
le 24 Août 2015
1 commentaire
dpb
le 24 Août 2015
Modifié(e) : dpb
le 24 Août 2015
While again I don't have the Mapping Toolbox to investigate/experiment with, there's likely a reason for the following note in the doc's--
"Map axes are standard MATLAB axes with different default settings for some properties and a MATLAB structure for storing projection parameters and other data. The main differences in default settings are." "Axes properties XGrid, YGrid, XTick, YTick are set to 'off'."
Have you tried the alternate properties
MLineLimit
[north south] | [south north] {[]}
Grid meridian limits — ...
MLineLocation
scalar interval or specific vector {30º}
Grid meridian interval or specific locations — ...
and the analogous Pxxxx versions for parallels?
No idea what may/may not function correctly with the underlying grid but seems only prudent to use the tools as intended...
Plus de réponses (1)
dpb
le 23 Août 2015
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.
0 commentaires
Voir également
Catégories
En savoir plus sur Axis Labels dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!