Setting the independent colors of multiple surfaces

4 ビュー (過去 30 日間)
Jonathan Rabe
Jonathan Rabe 2020 年 3 月 23 日
回答済み: Jonathan Rabe 2020 年 3 月 23 日
Hi all,
I am working on a numerical methods project where I would like to model a volume. I would later like to plot the surfaces depending on their temperature, so I need to have each plot to be a different colour. However, if I use the following code, regardless of setting the colormap each time, the colour gets overwritten with the last function. Please help.
[z, y, x] = cylinder(dRadius, 20);
surf(x*discWidth, y, z);
alpha(alph);
colormap([0, 1, 0]);
hold on;
[z, y, x] = cylinder(dRadius*2, 20);
surf(x*discWidth, y, z);
alpha(alph);
colormap([0, 1, 0]);
[z, y, x] = cylinder(dRadius*3, 20);
surf(x*discWidth, y, z);
alpha(alph);
colormap([0, 1, 0]);
[z, y, x] = cylinder(dRadius*4, 20);
surf(x*discWidth, y, z);
alpha(alph);
colormap([0.6, 1, 0]); %this seems to dictate what the total colour is.

採用された回答

Jonathan Rabe
Jonathan Rabe 2020 年 3 月 23 日
This line seemed to work well with a facecolor argument...
surf(x, y, (b+z*discWidth), 'FaceColor', [Temps(elem, ringno)/100, 0, 1-Temps(elem, ringno)/100], 'LineWidth', lwidth);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOrange についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by