Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
Takahiro Sasaki
Takahiro Sasaki le 7 Fév 2023
Commenté : Takahiro Sasaki le 8 Fév 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

Réponse acceptée

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

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur グラフィックス パフォーマンス dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!