Pick random colors from a color map
31 ビュー (過去 30 日間)
古いコメントを表示
I have up to 30 variables that may be plotted in 1 figure. There are 2 sets of data, each with 15 variables.
I want to have 2 seperate color maps, so I can identify each set of data.
I initially did this:
cmap1=colormap(hot(15))
cmap2=colormap(winter(15))
However, by doing this, it seems it is just using the first 15 values of each colormap. How would I go about picking 15 random colors out of the whole color map?
0 件のコメント
採用された回答
Image Analyst
2013 年 2 月 5 日
Try this:
% Define the two colormaps.
cmap1 = hot(15)
cmap2 = winter(15)
% Combine them into one tall colormap.
combinedColorMap = [cmap1; cmap2]
% Pick 15 rows at random.
randomRows = randi(size(combinedColorMap, 1), [15, 1])
% Extract the rows from the combined color map.
randomColors = combinedColorMap(randomRows, :)
0 件のコメント
その他の回答 (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!