Azzera filtri
Azzera filtri

Plot two plots in a 3d figure

1 visualizzazione (ultimi 30 giorni)
Sebby RedRice
Sebby RedRice il 4 Set 2018
Modificato: jonas il 5 Set 2018
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 Commenti
Sebby RedRice
Sebby RedRice il 5 Set 2018
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 il 5 Set 2018
Modificato: jonas il 5 Set 2018
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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Lighting, Transparency, and Shading in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by