Plot two plots in a 3d figure

1 次查看(过去 30 天)
Sebby RedRice
Sebby RedRice 2018-9-4
编辑: jonas 2018-9-5
I am trying to put two plots of atmospheric kinetic energy into one figure that contains 3 axes. The axis sticking out of the screen would represent latitude, the axis going 'left-and-right' would be longitudes and the z-axis would be the height.
I would like to produce a 2D slice of kinetic energy into the latitude-height plane and another 2D slice of kinetic energy in the longitude-height plane. So basically, that would give two plots in the same figure. The data in which I am working with is the following:
Longitude and latitude coordinates are in separate matrices of 172x160 respectively (would later turn into meshgrids of 16x172 and 16x160)
Height coordinates is in a matrix of pressure coordinate 16x1 (would later turn into a meshgrid of 16x60)
The kinetic energy is within a 3d matrix of 172x160x16. Hence, a 2D slice of energy in the latitude-height plane would have the size of 16x160 because of the average in the longitude axes.
I made a small drawing in paint to show what it should like.
I can do a 2D slice by itself, and it would something like this with the code and figure: (Note that I'm representing another form of energy, but the structure remains the same)
%%%%%Code : creating a single 2D slice along a latitude-axis
figure('color','white');
%Set pressure
Pres = [1000 975 950 925 900 850 800 700 600 500 400 300 250 200 150 100];
%Set grid for energy
x1 = 0;
x2 = 160;
ni = 160;
np = 16;
x_file = linspace(x1,x2,ni);
[x,p]=meshgrid(x_file,Pres);
%Set map
pcolor(x,p,Fld_LongAvg') %Where Fld_LongAvg' is the energy matrix (16x160)
hold on
shading interp
set(gca,'layer','top')
%Set y-axis (pressure axis)
set(gca,'yScale','log');
axis('ij')
set(gca,'ylim',[100 1000],'ytick',100:100:1000,'FontSize',18)
%Set x-axis (latitude axis)
set(gca,'Ygrid','on')
set(gca,'XTick',[0 160],'XtickLabel',{['Éq'],['N']})
%%%%%End of code
--> It has come to my attention that I don't even use the latitude coordinate matrix to set my x-axis, but I believe that would be for the best so that I could have proper x-ticks and labels. However, it appears unecessary to use that latitude coordinate matrix in order to get a proper plot.
However, what I’m interested is to have both 2D slices together. Does anybody have any idea where to begin as I wasn't able to find documentation for this sort of task?
  9 个评论
Sebby RedRice
Sebby RedRice 2018-9-5
Yes exactly! Altought I believe I also have it figured out after dpb linked me with the slice documentation. It made me think about why he sent me that specifically and I noticed eventually that I had my words all messed up!. Indeed, what I was tyring to show wasn`t a slice at all! Instead, I used surf on both maps and set xlim and ylim in such a way that both figures would be on the edges of the axes!. Thanks for all your help! Now I have to figure out a way to plot north america and also to add some actual 3d figures to it. Cheer.
jonas
jonas 2018-9-5
编辑:jonas 2018-9-5
I won't post my code as an answer as it is quite buggy. Have a look in the attached m-file if you'd like.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by