How to Plot Grid on a Scatter Plot?

22 次查看(过去 30 天)
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;

采纳的回答

Star Strider
Star Strider 2021-2-4
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
.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by