How can I change the colormap for each tab in a tabbed figure?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am trying to create a tabbed figure where each of the two tabs has a different viewshed plotted on terrain using the mapping toolbox. I am able to create the tabbed figure, but I am unable to figure out how to use a different colormap on each tab. With the code below both of the tabs are using the colormap from the first tab (summer(2)). I've also been able to get both tabs to take on the colormap from the second tab (flipud(summer(2)) by not setting h1=axesm for the first tab and not setting h2=axesm for the second tab. Is there a way to set a different colormap for each tab of the figure?
figure(1);
tg=uitabgroup();
thistab=uitab(tg,'title','Terrain');
axes('Parent',thistab)
h1=axesm('globe','geoid',1.7365E+06);
meshm(viewshed,refmat,size(Z), Z);
axis tight
camposm(0,90,1e4)
camupm(90,0)
colormap(h1, summer(2))
shading interp
camlight
title('Terrain');
thistab=uitab(tg,'title','Visibility');
axes('Parent',thistab)
h2=axesm('globe','geoid',1.7365E+06);
hold on;
meshm(viewshed2,refmat,size(Z),Z);
axis tight
camposm(0,90,1e4)
camupm(90,0)
colormap(h2, flipud(summer(2)))
shading interp
camlight
title('Visibility 1');
Additional info: I'm running this code from app designer. Since mapping toolbox axes aren't well supported for UIAxes I'm trying to use tabbed figures to organize all the mapping toolbox based plots generated by my app.
Thank you in advance for the help!
0 commentaires
Réponse acceptée
lvn
le 9 Oct 2019
The code you gave didn't run on my PC because of a problem with viewshed. The following code runs and does not show the problem you mention (colorbars are different)
clear; close all; Z = 500*peaks(100);
refvec = [ 1000 0 0];
[lat1,lon1,lat2,lon2]=deal(-0.027,0.05,-0.093,0.042);
[visgrid,visleg] = viewshed(Z,refvec,lat1,lon1,100);figure(1);
tg=uitabgroup();
thistab=uitab(tg,'title','Terrain');
axes('Parent',thistab)
h1=axesm('globe','geoid',1.7365E+06);
meshm(visgrid,visleg,size(Z),Z);
axis tight
camposm(0,90,1e4)
camupm(90,0)
colormap(h1, summer(2)); colorbar;
shading interp
camlight
title('Terrain');
thistab=uitab(tg,'title','Visibility');
axes('Parent',thistab)
h2=axesm('globe','geoid',1.7365E+06);
hold on;
meshm(visgrid,visleg,size(Z),Z);
axis tight
camposm(0,90,1e4)
camupm(90,0)
colormap(h2, flipud(summer(2))); colorbar;
shading interp
camlight
title('Visibility 1');
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!