Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the standard colors for plots in Mathematica?

Tags:

(Note: All the answers to this question are valid for versions of Mathematica before version 10. For versions 10 and above, see https://mathematica.stackexchange.com/questions/54486/how-to-access-new-colour-schemes-in-version-10 and https://mathematica.stackexchange.com/questions/54629/what-are-the-standard-colors-for-plots-in-mathematica-10.)

When using the Plot or ListPlot command in Mathematica, certain default colors are chosen.

For reasons of uniformity within some report I would like to use them along with the PlotStyle option. It turned out that I cannot reproduce the default colors with the pre-defined color names, although blue and purple seem to be somehow close.

Hence my question:

How can I chose the standard colors used by Mathematica in plots along with PlotStyle?

Thank you in advance.

Nice answers were given by belisarius and Sjoerd from which we can conclude that

Plot[Sin[x], {x, 0, 2 Pi}, PlotStyle -> ColorData[1, 4]]

will result in a sine plotted in the fourth standard color, some nice green.

like image 435
Robert Filter Avatar asked Mar 22 '11 13:03

Robert Filter


People also ask

What is the use of plot style in Mathematica?

is an option for plotting and related functions that specifies styles in which objects are to be drawn.


1 Answers

I know this is really late to the game, but the expression used to generate the nth color in ColorData[1] is:

Hue[FractionalPart[0.67 + 2.0 (i - 1)/GoldenRatio], 0.6, 0.6] 

Update Based on Alexey's comment below, you can find this using:

ColorData[1] // InputForm 
like image 198
Eli Lansey Avatar answered Nov 07 '22 13:11

Eli Lansey