3次元プロットのカラースケールプロットと透明プロットを同時に描画することができません。
11 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Takahiro Sasaki
il 7 Feb 2023
Commentato: Takahiro Sasaki
il 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
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1288350/image.png)
0 Commenti
Risposta accettata
交感神経優位なあかべぇ
il 8 Feb 2023
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
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Annotations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!