How to Plot Grid on a Scatter Plot?

조회 수: 30 (최근 30일)
ercan duzgun
ercan duzgun 2021년 2월 4일
편집: ercan duzgun 2021년 2월 4일
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
.
  댓글 수: 2
ercan duzgun
ercan duzgun 2021년 2월 4일
편집: ercan duzgun 2021년 2월 4일
Dear @Star Strider , thank you so much. I really appreciate your help. :)
Star Strider
Star Strider 2021년 2월 4일
As always, my pleasure!

댓글을 달려면 로그인하십시오.

추가 답변 (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