フィルターのクリア

How can I make points show through a surface plot?

30 ビュー (過去 30 日間)
Samuel Harvey
Samuel Harvey 2021 年 7 月 28 日
コメント済み: Samuel Harvey 2021 年 7 月 28 日
I have code that makes a centerline (left) then creates a surface around that centerline (right). I'd like the centerline points to show through the surface so I can still see them while I rotate it around. How can I do this?
Edit: To be more clear, I am specifically not looking for the entire surface to be transparent. I don't want to see the back side of the surface showing through, just the centerline.

採用された回答

Chunru
Chunru 2021 年 7 月 28 日
% Plot a sphere and a line
[x, y, z] = sphere;
h = surf(x, y, z);
hold on
plot3(-1:1, zeros(3,1), zeros(3,1), 'r', 'LineWidth', 3);
h.FaceAlpha = 0.5; % make it transparent to see inside
  3 件のコメント
Chunru
Chunru 2021 年 7 月 28 日
Then you can use two axes:
ax1 = axes('XLim', [-1,1], 'YLim', [-1,1], 'ZLim', [-1,1]);
view(3);
ax2 = copyobj(ax1, gcf);
[x,y,z]=sphere;
h = surf(ax1, x, y, z)
h =
Surface with properties: EdgeColor: [0 0 0] LineStyle: '-' FaceColor: 'flat' FaceLighting: 'flat' FaceAlpha: 1 XData: [21×21 double] YData: [21×21 double] ZData: [21×21 double] CData: [21×21 double] Show all properties
plot3(ax2, -1:1, zeros(3,1), zeros(3,1), 'r', 'LineWidth', 3);
axes(ax2);
box off
axis off
Samuel Harvey
Samuel Harvey 2021 年 7 月 28 日
Perfect, that's what I'm looking for. Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by