Setting colormap to lines from streamslice
3 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I am trying to apply a colormap to a set of lines generated via streamslice.
The general approach seems to be to set all the lines to a single color through the following method:
h = streamslice(X,Y,Z,uData,vData,zData,[],[],[],5);
set(h,'Color','k');
All the streamlines are grouped in h and share the Primitive Line charateristics, hence the colormap property does not apply to them.
I have tried setting the colormap to the axis Color Order parameter before generating the streamlines but that seems to get overwitten by the default color order once I plot the streamlines. Although I use a 256 x 3 color space, the number of streamlines that are generated far exceeds this which means I cannot assign an individual color to each of the lines in h.
For context, the end result I wanted to achieve is something along the lines of the image below. Any help would be appreciated. Thanks a lot
2 件のコメント
vidyesh
2024 年 1 月 22 日
MATLAB uses Hexadecimal Color Code which has 16,777,216 (256 x 256 x 256) possible colors.
Do the number of lines exceed this?
採用された回答
Taylor
2024 年 1 月 23 日
You could just randomly generate the colors:
load wind
lineObj = streamslice(x,y,z,u,v,w,[],[],5,'noarrows');
for ii = 1:length(lineObj)
lineObj(ii).Color = [rand(1) rand(1) rand(1)];
end
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Colormaps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!