3次元プロットのカラ​ースケールプロットと​透明プロットを同時に​描画することができま​せん。

1 次查看(过去 30 天)
Takahiro Sasaki
Takahiro Sasaki 2023-2-7
3Dプロットについて質問させてください。
h1) カラースケール付きの三次元プロット
h2) 透明の三次元プロット
を同時に描画したいのですが、下記のコードで透明化処理「h2.Color(4)=0.5;」を入れると、h1のカラー情報が消えてしまいます。
h1/h2の両立は可能でしょうか?
試しに「h2.Color(4)=0.5;」をコメントアウトするとh1のカラー情報は残ったまま描画されますが、当然h2のプロットが透明化されません。(図を参照)
ご助言いただけますと幸いです。
t = 0:pi/500:pi;
xt1 = sin(t).*cos(10*t);
yt1 = sin(t).*sin(10*t);
zt1 = cos(t);
xt2 = sin(t).*cos(12*t);
yt2 = sin(t).*sin(12*t);
zt2 = cos(t);
h1 = plot3(xt1,yt1,zt1);
n = length(t);
cd = [uint8(jet(n)*255) uint8(ones(n,1))].';
drawnow
set(h1.Edge, 'ColorBinding','interpolated', 'ColorData',cd);
hold on
h2 = plot3(xt2,yt2,zt2);
h2.Color(4)=0.5;
hold off

采纳的回答

交感神経優位なあかべぇ
h1.EdgeのColorDataの4行目を255に変更してみたところ、上手くいきました。
t = 0:pi/500:pi;
xt1 = sin(t).*cos(10*t);
yt1 = sin(t).*sin(10*t);
zt1 = cos(t);
xt2 = sin(t).*cos(12*t);
yt2 = sin(t).*sin(12*t);
zt2 = cos(t);
h1 = plot3(xt1,yt1,zt1);
n = length(t);
cd = [uint8(jet(n)*255) repmat(0xFF,n,1)].'; % 4行目の値を255に変更
drawnow
set(h1.Edge, 'ColorBinding','interpolated', 'ColorData',cd);
hold on
h2 = plot3(xt2,yt2,zt2);
h2.Color(4)=0.5;
hold off
  1 个评论
Takahiro Sasaki
Takahiro Sasaki 2023-2-8
ありがとうございました!
いただいた回答でこちらでも再現できました。

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 グラフィックス パフォーマンス 的更多信息

Community Treasure Hunt

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

Start Hunting!