Message Boards Message Boards

0
|
6755 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Default Chart Color Schemes

Posted 11 years ago
I wish to use the same color scheme as in the default pie chart to generate some companion graphics. For example, the colors in PieChart[Range[10]]. However, I can't find that exact color scheme the charts use listed anywhere in the documentation.  Anyone know if it is accessible? 
POSTED BY: John Meeker
2 Replies
You may extract the exact colors that PieChart is using so you will not need to look for the specific color scheme it is using
Say you generate a Pie chart of 10 elements
g=PieChart[Range[10]]
The colors used by PieChart can be extracted (you need to drop the first two, so I use Drop...]
colors=Drop[Cases[g,_RGBColor,Infinity],2]
Now you can use the same colors as the PieChart inside Plot or any other graphics you would like

Plot[Evaluate[Table[n t, {n, 10}]], {t, 0, 1}, PlotStyle -> colors]
Although the above is a "quick" solution, it is also a "dirty" one, since it relies on the internals of PieChart. I would consider to use the same color scheme just by dictating both PieChart and Plot to use it (see the option for ColorFunction for both).

yehda
The color scheme appears to be

PieChart[Range[10],
ColorFunction -> Function[{angle}, ColorConvert[Hue[0.6 - 0.6 angle, 0.34, 1], "RGB"]]]

or more simply,

PieChart[Range[10],
ColorFunction -> Function[{angle}, Hue[0.6 - 0.6 angle, 0.34, 1]]]

Seems to work on Range for n = 10, 15, 20, ....
POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract