scatter3 plot to a mesh plot or surface plot
17 次查看(过去 30 天)
显示 更早的评论
I have (x,y,z) coordinate points and corresponding intensity values (c) at each of those points. I currently have a scatter plot for this, but I want to turn it into a mesh plot or surface plot to better visualize the trends and keep the colorbar for the intensity values. Any help would be greatly appreciated! This is what I have right now:
x = [0 -9 9 0 -9 9 0 -9 9 0 -9 9 0 -9 9];
y = [17 17 17 10 10 10 10 10 10 10 10 10 17 17 17];
z = [11 11 11 11 11 11 7 7 7 15 15 15 15 15 15];
c = [33 33 33 21 24 13 11 24 15 13 24 11 25 22 32];
markerSize = 50;
scatter3(x,y,z,markerSize,c,'filled')
colorbar
0 个评论
回答(1 个)
Carlos Guerrero García
2022-11-30
编辑:Carlos Guerrero García
2022-11-30
I don't know what kind of surface do you want to add...perhaps something like this???
x = [0 -9 9 0 -9 9 0 -9 9 0 -9 9 0 -9 9];
y = [17 17 17 10 10 10 10 10 10 10 10 10 17 17 17];
z = [11 11 11 11 11 11 7 7 7 15 15 15 15 15 15];
c = [33 33 33 21 24 13 11 24 15 13 24 11 25 22 32];
markerSize = 50;
scatter3(x,y,z,markerSize,c,'filled');
colorbar;
hold on;
surf([-9 9],[10 10],[7 7;15 15],'FaceAlpha',0.15)
3 个评论
Carlos Guerrero García
2022-11-30
编辑:Carlos Guerrero García
2022-11-30
Something like this ??
x = [0 -9 9 0 -9 9 0 -9 9 0 -9 9 0 -9 9];
y = [17 17 17 10 10 10 10 10 10 10 10 10 17 17 17];
z = [11 11 11 11 11 11 7 7 7 15 15 15 15 15 15];
c = [33 33 33 21 24 13 11 24 15 13 24 11 25 22 32];
colorplanes=parula; % parula is the name of the default colormap
markerSize = 50;
for k=0:0.2:17;
scatter3(x,y,z,markerSize,c,'filled');
colorbar;
hold on;
surf([-9 9],[10+7*k/17 10+7*k/17],[7 7;15 15],'FaceAlpha',0.15,'FaceColor',colorplanes(1+floor(k*63/17),:));
drawnow;
hold off;
end
另请参阅
类别
在 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!