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

dpb
dpb 2018년 9월 4일
So what did you use to do the above???
Sebby RedRice
Sebby RedRice 2018년 9월 4일
Right my bad, I edited my question to incorporate the code.
jonas
jonas 2018년 9월 4일
Unclear what you want the final plot to look like. You want to overlay two surface plots? Surely you will need a double x axis, one for lat and one for lon?
dpb
dpb 2018년 9월 4일
How about attach .mat file containing the FLD data array so folks can piddle???
Sebby RedRice
Sebby RedRice 2018년 9월 4일
Jonas,
I want to have two 2d plots on two different planes of the same figure that has a x-y-z (longitude-latitude-height) axis. One of these 2d plots would be on the lat-height plane and the other would be on the long-height plane. The latitude and longitude are consequently not on the same x-axis, because one of the 2d plots would be on the y-axis. I hope that makes it clearer!
dpb, I attached to the question a .mat that contains both plots that I want to show. One is Fld_LatAvg which is the latitude averaged data (172x16) and the other is Fld_LongAvg and is the longitude average data (160x16).
I'm sorry I don't have the time to play with it much at the moment, but look at
doc slice
and see if you can't turn your 2D data into a 1-plane 3D volume and use slice to present the two on the desired faces in a 3D axis.
jonas
jonas 2018년 9월 5일
Just to be clear. Are you looking for something like this?
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개)

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2018년 9월 4일

편집:

2018년 9월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by