How to combine multiple contourf plots into one 3d contour plot?
16 次查看(过去 30 天)
显示 更早的评论
I have contour plots on 3 faces of a solid object; front xy, bottom xz and rear xy. Further analysis takes quite some time in working on 3 contour plots which I plan to reduce by combining these to a 3d contour plot. For intermediate points, I would like to linearly interpolate the values inside the solid object. I have experimented with matlab a lot but when it comes to 3D plotting, things get complicated for me. I will show my contours to you and then explain after plotting them
clc
clear all
close all
load('Data_trimmed.mat')
x1 = x1 - 150;
x2 = x2 - 150;
x3 = x3 - 150;
figure('units','inch','position',[30,5,3,5]);
tiledlayout(3,1,"TileSpacing","tight","Padding","compact")
nexttile
hold on
rectangle('Position',[0 0 300 300],'FaceColor',[1 1 1],FaceAlpha=0.5)
[c12,h12] = contourf(x1,y1,ua, 'ShowText','on',FaceAlpha=0.6,EdgeAlpha=0.5,EdgeColor='k',LevelStep=10);
clabel(c12,h12,'FontSize',7,'Color','k',fontname='Times New Roman')
contourcmap("parula",20,"Colorbar","off")
xlim([0 300])
ylim([0 300])
title('xy plane with z = 0')
nexttile(2)
hold on
xline(1150,':r','Alpha',0.5,'FontSize',6,Interpreter='latex')
rectangle('Position',[0 0 300 200],'FaceColor',[1 1 1],FaceAlpha=0.5)
[d12,k12] = contourf(x2,z2,va, 'ShowText','on',FaceAlpha=0.6,EdgeAlpha=0.5,EdgeColor='k',LevelStep=10);
clabel(d12,k12,'FontSize',7,'Color','k',fontname='Times New Roman')
contourcmap("parula",20,"Colorbar","off")
ylim([0 200])
axis ij
xlim([0 300])
title('xz plane with y = 0')
nexttile(3)
hold on
xline(1150,':r','Alpha',0.5,'FontSize',6,Interpreter='latex')
rectangle('Position',[0 0 300 300],'FaceColor',[1 1 1],FaceAlpha=0.5)
[e12,m12] = contourf(x3,y3,wa, 'ShowText','on',FaceAlpha=0.6,EdgeAlpha=0.5,EdgeColor='k',LevelStep=10);
clabel(e12,m12,'FontSize',7,'Color','k',fontname='Times New Roman')
contourcmap("parula",20,"Colorbar","off")
xlim([0 300])
ylim([0 300])
title('xy plane with z = 200, shown inverted')
axis ij
In the figture above, the first plot shows xy contour on front face, the second plot shows the contour on bottom face and the 3rd shows on back face (inverted). It is shown in a way that it looks like an unwrapped surface contours. I plan to make 1 3d contour plot which gives these values on the outer surfaces but interpolated values inside the solid. If you need more information, we can discuss in the comments. The values do not start from the zero edges exactly, and can be extrapolated later on. I am only interested in plotting the 3d contour plot. Your help will be appreciated.
Thank you
Best
2 个评论
Star Strider
2025-3-18
Looking aat these as surf plots makes them a bit easier to understand. What do they represent? (The data source is not important. The context — what they represent — is important.)
I do not understand what you want to do with them.
clc
clear all
close all
load('Data_trimmed.mat')
x1 = x1 - 150;
x2 = x2 - 150;
x3 = x3 - 150;
figure('units','inch','position',[30,5,3,5]);
tiledlayout(3,1,"TileSpacing","tight","Padding","compact")
nexttile
hold on
rectangle('Position',[0 0 300 300],'FaceColor',[1 1 1],FaceAlpha=0.5)
[c12,h12] = contourf(x1,y1,ua, 'ShowText','on',FaceAlpha=0.6,EdgeAlpha=0.5,EdgeColor='k',LevelStep=10);
clabel(c12,h12,'FontSize',7,'Color','k',fontname='Times New Roman')
contourcmap("parula",20,"Colorbar","off")
xlim([0 300])
ylim([0 300])
title('xy plane with z = 0')
nexttile(2)
hold on
xline(1150,':r','Alpha',0.5,'FontSize',6,Interpreter='latex')
rectangle('Position',[0 0 300 200],'FaceColor',[1 1 1],FaceAlpha=0.5)
[d12,k12] = contourf(x2,z2,va, 'ShowText','on',FaceAlpha=0.6,EdgeAlpha=0.5,EdgeColor='k',LevelStep=10);
clabel(d12,k12,'FontSize',7,'Color','k',fontname='Times New Roman')
contourcmap("parula",20,"Colorbar","off")
ylim([0 200])
axis ij
xlim([0 300])
title('xz plane with y = 0')
nexttile(3)
hold on
xline(1150,':r','Alpha',0.5,'FontSize',6,Interpreter='latex')
rectangle('Position',[0 0 300 300],'FaceColor',[1 1 1],FaceAlpha=0.5)
[e12,m12] = contourf(x3,y3,wa, 'ShowText','on',FaceAlpha=0.6,EdgeAlpha=0.5,EdgeColor='k',LevelStep=10);
clabel(e12,m12,'FontSize',7,'Color','k',fontname='Times New Roman')
contourcmap("parula",20,"Colorbar","off")
xlim([0 300])
ylim([0 300])
title('xy plane with z = 200, shown inverted')
axis ij
figure
tiledlayout(3,1)
nexttile
surf(ua)
title('ua')
nexttile
surf(va)
title('va')
nexttile
surf(wa)
title('wa')
.
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!