Multiple surf woth different colorbar limits on a single plot
10 次查看(过去 30 天)
显示 更早的评论
I am plotting three surfaces at different Z values on a single plot. The code works but I need the different colorbar limits. At the moment all the three surface keep the colorbar limits of the last surface plotted. Any suggestion to have three different colorbar limits?
I am attaching the code with the matrices needed to make the plot.
z=[200;250;400];
CX=[230,236;224,230;218,224];
figure;
for i=1:size(M,3)
MAT=squeeze(M(:,:,i));
Z=ones(size(MAT))*z(i);
fl=surf(lon,lat,Z,MAT);
fl.LineStyle='none';
hold on;
clim(CX(i,:));
xlim([0 20]);
ylim([30 45]);
end
ax=gca;
ax.ZDir='reverse';
0 个评论
采纳的回答
Walter Roberson
2023-5-20
You appear to be using older-style graphics (in particular not App Designer / uifigure)
In this situation you can call the File Exchange Contribution freezeColors https://www.mathworks.com/matlabcentral/fileexchange/7943-freezecolors-unfreezecolors
You would plot the first surface with the first color axes limits, use freezeColors to convert it to RGB, plot the second surface with the second color axes limits, use freezeColors again to convert that part to RGB, then plot the third surface with the third color axes limits.
This process does not provide for dynamic manipulation of the color axes limits, but at least it works.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!