Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
Takahiro Sasaki
Takahiro Sasaki am 7 Feb. 2023
Kommentiert: Takahiro Sasaki am 8 Feb. 2023
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

Akzeptierte Antwort

交感神経優位なあかべぇ
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 Kommentar
Takahiro Sasaki
Takahiro Sasaki am 8 Feb. 2023
ありがとうございました!
いただいた回答でこちらでも再現できました。

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu グラフィックス パフォーマンス finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!