default figure color order
Mostrar comentarios más antiguos
I have a figure with two data sets, one is blue and the other is dark green. I didn't specify the colors. I need to find out what the colors are so that when I make other figures and can keep the color constant, data set one = blue, data set two = dark green.
Everything I read online about color is for making color gradients, I just need to figure out what the default color values are. Thanks!
Respuesta aceptada
Más respuestas (3)
Steven
el 19 de Sept. de 2014
If you just want to know the default color before plotting, you can try
get(gca,'colororder')
Image Analyst
el 16 de En. de 2012
From the help:
plot automatically chooses colors and line styles in the order specified by ColorOrder and LineStyleOrder properties of current axes. MATLAB supports four line styles, which you can specify any number of times in any order. MATLAB cycles through the line styles only after using all colors defined by the ColorOrder property. For example, the first eight lines plotted use the different colors defined by ColorOrder with the first line style. MATLAB then cycles through the colors again, using the second line style specified, and so on.
So you want to do something like:
set(gca, 'ColorOrder', myColorOrder, 'NextPlot', 'replacechildren');
where myColorOrder is an N by 3 array of your custom colors. See my demo for setting ColorOrder here: http://www.mathworks.com/matlabcentral/answers/19815-explicitly-specifying-line-colors-when-plotting-a-matrix
Jim
el 17 de Dic. de 2025
Movida: Image Analyst
el 18 de Dic. de 2025
get(groot, "defaultaxescolororder")
ans =
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
Categorías
Más información sobre Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!