How to plot contourf plot on one side of surf plot?

56 visualizzazioni (ultimi 30 giorni)
I saw a plot in the journal that I want to replicate in Matlab (the original plot is done by Python, I think). The plot shows a 2D wavy interace with 2D velocity profile on the sides of the plot. In Matlab, I can use surf to create 2D wave interace as a function of x and y where the height is in z. However, I am not sure how I could plot these 2D velocity profile in x-z or y-z plane. If just use contourf to plot it, it will plot on the x-y axis as default. Therefore I am wondering whether it is possible to plot contourf on select axis with the surf plot? Thank you!
  9 Commenti
Jinshi
Jinshi circa 11 ore fa
Wow @DGM this is exactly what I need! What a clever way to solve my question. The colormap is not a problem (yet) since there is no colormap on eta and the colormap for my x-z and y-z plot should be the same. I'd like to accept your answer but it seems that you put this in the comment section rather than the answer section... Please let me know how to accept your answer and I am more than happy to do that!
Best,
Jinshi
DGM
DGM circa 9 ore fa
I just moved it to an answer.

Accedi per commentare.

Risposta accettata

DGM
DGM circa 12 ore fa
Spostato: DGM circa 9 ore fa
This is a start.
load data_3D_2D.mat
surf(xx_eta,yy_eta,eta,'edgecolor','none');
hold on; grid on; axis equal
yy_u = max(yy_eta(:))*ones(size(xx_u)); % constant y-data at the edge of the plot
surf(xx_u,yy_u,zz_u,u,'edgecolor','none','facelighting','none');
Depending on your expectations, it might need to get more complicated. One potential issue is that both of these objects use the same colormap and color scaling (i.e. clim()). Since an axes has one set of color mapping properties, if you wanted to use different colormaps or color scales, the way around that is to use multiple overlaid axes.

Più risposte (0)

Categorie

Scopri di più su Data Distribution Plots in Help Center e File Exchange

Prodotti


Release

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by