scatter3 plot to a mesh plot or surface plot

16 views (last 30 days)
SHREYA
SHREYA on 30 Nov 2022
Commented: SHREYA on 1 Dec 2022
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

Answers (1)

Carlos Guerrero García
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
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
SHREYA
SHREYA on 1 Dec 2022
Its not quite what I'm looking for but thanks!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!