Changing marker color
18 ビュー (過去 30 日間)
古いコメントを表示
I would like to scale the color of a marker based on temperature values being plotted there. For example, to plot 10 temperatures scaled from red to white I could use
for n = 1:10
TempScaled = (Temp(n) - min(Temp))/(max(Temp)-min(Temp));
plot(x(n),y(n),'.','MarkerSize',20,'color',[TempScaled 1 1]);
end
But I would like to use a more traditional and easy-to-read color scale, such as 'hot'. Any ideas of how I can do this?
1 件のコメント
Sahil Bharti
2021 年 7 月 29 日
Hi,
I wish to use the scaller plot with data polotted with different colors as received in the ABAQUS cae output.
How to plot
回答 (3 件)
Jan
2012 年 3 月 3 日
color = hot(20);
for n = 1:10
TempScaled = (Temp(n) - min(Temp)) / (max(Temp) - min(Temp));
plot(x(n), y(n), '.', 'MarkerSize', 20, 'color', color(n, :));
end
[EDITED, accepted flag cleared]
0 件のコメント
Chad Greene
2012 年 3 月 2 日
1 件のコメント
Jan
2012 年 3 月 3 日
There is a FOR loop inside SCATTER also. If you want to write efficient code, it would be better to replace the PLOT by LINE in your FOR loop.
It sounds like you have accepted my answer accidently. Therefore I delete it and re-post it. This remove the existing acceptance flag and you can reset it. Ok?
参考
カテゴリ
Help Center および File Exchange で Graphics Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!