What colormap is used to generate ColorOrder?

55 ビュー (過去 30 日間)
KAE 2017 年 2 月 9 日
編集済み: Stephen23 2018 年 5 月 21 日
What colormap is used to generate the default ColorOrder used for successive lines in a plot? (I am asking because I want to automatically generate these default colors, and thought colormap might be a way to do so.) In R2016b, these colors can be listed as,
c = get(0, 'DefaultAxesColorOrder')
c =
0 0.4470 0.7410
0.8500 0.3250 0.0980
0.9290 0.6940 0.1250
0.4940 0.1840 0.5560
0.4660 0.6740 0.1880
0.3010 0.7450 0.9330
0.6350 0.0780 0.1840
which is a dull red, blue, yellow, etc. My first thought was that the rows of c came from the parula colormap, the default for pcolor-style plots, but no rows of c and p match,
K>> p = parula(7)
p =
0.2081 0.1663 0.5292
0.0244 0.4350 0.8755
0.0265 0.6137 0.8135
0.1986 0.7214 0.6310
0.6473 0.7456 0.4188
0.9856 0.7372 0.2537
0.9763 0.9831 0.0538
I think it's some kind of visually balanced colormap ordered so each line's color is distinct from its neighbors. What colormap is it?


Stephen23 2017 年 2 月 9 日
編集済み: Stephen23 2018 年 5 月 21 日
Who said that the ColorOrder is based on any other colormap? Certainly not the MATLAB documentation:
No mention of "colormap" on any of those pages, because the ColorOrder is its own set of colors, not based on any of the inbuilt MATLAB colormaps.
Note that the colormap lines is defined such that it "matches the default ColorOrder property of the Axes", and its is based around the command get(0,'defaultAxesColorOrder'), so lines is a colormap that is defined in terms of the ColorOrder (but the ColorOrder is not defined in terms of any colormap).
PS: As you have noticed, the 2014b+ ColorOrder are certainly not based on parula: clearly the maroon and purple colors do not exist in parula. And similarly the pre-2014b ColorOrder is not based on jet, because jet never has any gray or magenta values. This quickly disproves this persons erroneous answer:
PPS: Does anyone have a stackexchange account and would like to comment on that answer as being factually incorrect?
  4 件のコメント
Stephen23 2017 年 2 月 9 日
That would work too :)


その他の回答 (1 件)

Abby Skofield
Abby Skofield 2018 年 5 月 1 日
The lines command returns "the color scheme matches the default ColorOrder property of the Axes." In the default case, the following code
co = lines(7)
returns the 7 colors in the default Axes ColorOrder. The lines function is one of the family of predefined colormap functions .
  1 件のコメント
KAE 2018 年 5 月 1 日
Thanks; I learned something new!



Find more on Colormaps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by