Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Overlap different axes on a 3d map
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello everyone,
I have the following 3d figure:
This figure shows the north American boundaries (blue lines) along with surface temperature (colorbar, in kelvins) and geopotential height (the 3d mesh in dark blue, in decameters). After much trial and error, I was able to get this figure by doing the following code. I plotted temperature by using surf, the domain by using axesm and the geopotential height by using surface.
figure('rend','painters','pos',[500 500 1000 800])
%1) Add temperature profile
TTsurf = surf(yy_grid,xx_grid,zeros(size(yy_grid)),Temperature_map); %Size 172x160
set(TTsurf,'FaceColor','interp','EdgeColor','interp')
colorbar
caxis([200 300]);
hold on
%2 Prepare domain map
%Coordinates were obtained from a file
axesm('MapProjection','eqdcylin','Origin',[Grd_xlat1 Grd_xlon1 90-az],...
'FLonLimit',[lon1 lon2],'FLatLimit',[lat2 lat1],...
'FFill',400,'MeridianLabel','on',...
'ParallelLabel','on','MLabelParallel','south','Aspect','normal')
axis on
coast = load ('coast.mat');
geoshow(coast.lat,coast.long,'LineWidth',1)
tightmap
view(3)
zlim([0 1])
%3) Add geopotential height
GZsurf = surface(xx_grid,yy_grid,Geopotential_height);
set(GZsurf,'FaceColor','interp','EdgeColor','interp');
GZsurf.FaceAlpha = 0.5;
However, I would like my geopotential height mesh to have it's own colorbar. What currently happens is that this geopotential height acquires its dark blue color by the temperature colorbar. To create two colorbars (or rather, two axes), I read through the following post : https://www.mathworks.com/matlabcentral/answers/101346-how-do-i-use-multiple-colormaps-in-a-single-figure and concluded that the method I should try to follow is the example #5 (last method). As such, I arrive with the following code:
figure('rend','painters','pos',[500 500 1000 800])
%1) Add temperature profile
hAxesTT = axes;
axis(hAxesTT,'off')
colormap(hAxesTT,jet);
TTsurf = surf(yy_grid,xx_grid,zeros(size(yy_grid)),Temperature_map);
set(TTsurf,'FaceColor','interp','EdgeColor','interp')
colorbar
caxis([200 300]);
hold on
%2) Prepare domain map
axesm('MapProjection','eqdcylin','Origin',[Grd_xlat1 Grd_xlon1 90-az],...
'FLonLimit',[lon1 lon2],'FLatLimit',[lat2 lat1],...
'FFill',400,'MeridianLabel','on',...
'ParallelLabel','on','MLabelParallel','south','Aspect','normal')
axis on
coast = load ('coast.mat');
geoshow(coast.lat,coast.long,'LineWidth',1)
tightmap
view(3)
zlim([0 1])
%3) Add geopotential height
hAxesGZ = axes;
axis(hAxesGZ,'off')
colormap(hAxesGZ,cool);
GZsurf = surface(xx_grid,yy_grid,Geopotential_height);
set(GZsurf,'FaceColor','interp','EdgeColor','interp');
GZsurf.FaceAlpha = 0.5;
view(3)
This is a good improvement, but now it appears as though my geopotential height is no longer aligned with the rest of the domain and I don't know how to fix that.
Would anybody have any suggestions on how I should proceed? If anybody needs me to create a set of data in order for them to try it out, just ask in the comments and i'll edit the post.
Thank you,
댓글 수: 1
Walter Roberson
2018년 12월 20일
This Question was answered by the original poster, and closed by the original poster, who could have just deleted the question instead of posting a solution. The closing was thus within policy. However, I would like to recommend to the author to re-open it so that other people can learn from the question and the effort the author put into solving it.
답변 (1개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!