scatter3 plot to a mesh plot or surface plot
16 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Carlos Guerrero García
on 30 Nov 2022
Edited: Carlos Guerrero García
on 30 Nov 2022
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 Comments
Carlos Guerrero García
on 30 Nov 2022
Edited: Carlos Guerrero García
on 30 Nov 2022
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
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!