How to Plot Grid on a Scatter Plot?

20 views (last 30 days)
I want to add grids on that plot below. The grids should joints the points . Like similar to the mesh command.( https://www.mathworks.com/help/matlab/ref/mesh.html )
How can I add the grids onto that plot that you created? Is it possible?
This is continuation of my previous question before here:(https://www.mathworks.com/matlabcentral/answers/735077-how-to-put-dots-on-sphere-mesh-node-points)
For the plot the MATLAB command is:
[x,y,z] = sphere;
x = x(11:end,:);
y = y(11:end,:);
z = z(11:end,:);
r = 1;
figure
scatter3(r.*x(:),r.*y(:),r.*z(:), 0.001+z(:)*100, 'o', 'filled'); %# Plot the surface
axis equal;

Accepted Answer

Star Strider
Star Strider on 4 Feb 2021
Depending on the result you want, here are some options to experiment with:
[x,y,z] = sphere; %# Makes a 21-by-21 point sphere
x = x(11:end,:); %# Keep top 11 x points
y = y(11:end,:); %# Keep top 11 y points
z = z(11:end,:); %# Keep top 11 z points
r = 1; %# A radius value
figure
scatter3(r.*x(:),r.*y(:),r.*z(:), 0.001+z(:)*100, 'o', 'filled'); %# Plot the surface
hold on
mesh(x,y,z, 'EdgeColor','k', 'LineStyle','-')
hold off
axis equal; %# Make the scaling on the x, y, and z axes equal
figure
mesh(x,y,z, 'EdgeColor','k', 'LineStyle',':', 'FaceAlpha',0.1)
hold on
scatter3(r.*x(:),r.*y(:),r.*z(:), 0.001+z(:)*100, 'o', 'filled'); %# Plot the surface
hold off
axis equal; %# Make the scaling on the x, y, and z axes equal
.
  2 Comments
ercan duzgun
ercan duzgun on 4 Feb 2021
Edited: ercan duzgun on 4 Feb 2021
Dear @Star Strider , thank you so much. I really appreciate your help. :)

Sign in to comment.

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!