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

11 次查看(过去 30 天)
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 个评论
Jinshi
Jinshi 2025-11-12
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 2025-11-12
移动:DGM 2025-11-12
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Distribution Plots 的更多信息

产品


版本

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by