Plot two plots in a 3d figure
조회 수: 4 (최근 30일)
이전 댓글 표시
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195104/image.png)
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/195106/image.png)
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?
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Geographic Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!