Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

Mathematica 10 release appears to have changed the default styling of plots: the most visible changes are thicker lines and different default colors.

Thus, answers to this stackoverflow question are only valid for Mathematica < 10. For example, plots in this code will not give identical output in Mathematica 10, although they do in version 9:

fns = Table[x^n, {n, 0, 5}];
Plot[fns, {x, -1, 1}, PlotStyle -> ColorData[1, "ColorList"]]
Plot[fns, {x, -1, 1}]

enter image description here

So, my question is: what is the new way of getting the default colors to reproduce for own uses?

share|improve this question

marked as duplicate by Szabolcs, Michael E2, rasher, Jens, bobthechemist Jul 13 at 0:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Thanks for the Accept. I added another method if you are interested in only the colors rather than full styling information. –  Mr.Wizard Jul 12 at 9:50
    
@Mr.Wizard thanks, this update is really helpful! –  Ruslan Jul 12 at 11:23

2 Answers 2

up vote 12 down vote accepted

The colors alone are indexed color scheme #97:

ColorData[97, "ColorList"]

enter image description here

Update: further digging in reveals these PlotTheme indexed color relationships:

{"Default"   -> 97,  "Earth"       -> 98,  "Garnet"      -> 99,  "Opal"       -> 100,
 "Sapphire"  -> 101, "Steel"       -> 102, "Sunrise"     -> 103, "Textbook"   -> 104,
 "Water"     -> 105, "BoldColor"   -> 106, "CoolColor"   -> 107, "DarkColor"  -> 108,
 "MarketingColor" -> 109, "NeonColor" -> 109, "PastelColor" -> 110, "RoyalColor" -> 111,
 "VibrantColor"   -> 112, "WarmColor" -> 113};

The colors are returned as plain RGBColor expressions; the colored squares are merely a formatting directive. You can still see the numeric data with:

ColorData[97, "ColorList"] // InputForm
{RGBColor[0.368417, 0.506779, 0.709798], . . .,
 RGBColor[0.28026441037696703, 0.715, 0.4292089322474965]}

You can get a somewhat nicer (rounded decimal) display using using standard output by blocking the formatting rules for RGBColor using Defer:

Defer[RGBColor] @@@ ColorData[97, "ColorList"] // Column
RGBColor[0.368417, 0.506779, 0.709798]
. . .
RGBColor[0.280264, 0.715, 0.429209]

To get full styling information for the default and other Themes see:

For example:

Charting`ResolvePlotTheme[Automatic, Plot]

enter image description here

(Actually Automatic doesn't seem to be significant here as I get the same thing using 1 or Pi or "" in its place; apparently anything but another defined Theme.)

share|improve this answer
    
To find the RGB values of the colors (instead of just displaying them), you can use ToString/@ ColorData[97, "ColorList"]. Then, to display these values next to the corresponding color, you can use Grid@Transpose@{ColorData[97,"ColorList"], ToString/@ColorData[97, "ColorList"]}. If anyone can find a better method to find the RGB values, I'd love to hear it. –  seismatica Jul 12 at 21:11
1  
@seismatica See update. –  Mr.Wizard Jul 12 at 23:35

Try this

 fns = Table[x^n, {n, 0, 5}]; 
    Plot[fns, {x, -1, 1}, PlotTheme -> None] 
    Plot[fns, {x, -1, 1}, PlotTheme -> None]
share|improve this answer
1  
I seem to have read the question quite differently. I don't think Ruslan is asking how to reproduce the old defaults but rather how to access the directives underlying the new ones. –  Mr.Wizard Jul 12 at 6:35
    
Indeed, the old defaults are reproduced by first Plot in my example. –  Ruslan Jul 12 at 6:41
    
@Mr.Wizard, maybe you are right but I thought the way to get color manipulated as he want is to disable the new feature "Theme" so that it is not interfere with the way he used to change the color in V9. In all cases I think you are right that we need not to just disable this feature but rather understand it well so that we can work while the new feature is enabled. –  Algohi Jul 12 at 6:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.