What colormap is used to generate ColorOrder?

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?

 Risposta accettata

Stephen23
Stephen23 il 9 Feb 2017
Modificato: Stephen23 il 21 Mag 2018
None.
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 Commenti

Too bad because I was hoping to be able to functionally generate this set of colors, even if I change my own default colororder, and thought colormap was a way to do so.
Stephen23
Stephen23 il 9 Feb 2017
Modificato: Stephen23 il 21 Mag 2018
@KAE: Use lines to get the ColorOrder. If you want to generate similar colors to the ColorOrder, then search for "maximally distinct" or "distinguishable" colormaps, eg:
Try my FEX submission cubehelix, which lets you generate a huge number of colormaps with just a few parameters, including highly distinguishable ones.
You know, I could just write a function to return the matrix c from above. [I like the default colors and am seeking to use them for another application.]
That would work too :)

Accedi per commentare.

Più risposte (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 .

Categorie

Richiesto:

KAE
il 9 Feb 2017

Modificato:

il 21 Mag 2018

Community Treasure Hunt

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

Start Hunting!

Translated by