I have looked through other posts to find out what the default plot color is, but when I use it, the color doesn't seem to match. Can anyone explain why I'm seeing different output?
The reason I ask is that I'd like to provide higher level plotting function that have an optional color parameter. If you don't provide your own color, I'd like to use Mathematica's defaults...but it doesn't create the same output.
BarChart[Range[5]]
BarChart[Range[5], ChartStyle -> ColorData[1, 1]]
Thanks, Bill
Update: Thanks for the help so far. It looks like BarCharts get a different color set than regular plots, because ColorData[1, 1]
is the default color for Plot and ListPlot:
Plot[Sin[x], {x, -Pi, Pi}, PlotStyle -> Thickness[0.02]]
But I do like the color set that is the default for BarChart:
BarChart[{Range[5]}]
As I look through the available color pallets, I'm not sure I see those as an option:
Grid[Partition[
Framed[Show[ColorData[#, "Image"], ImageSize -> 100],
FrameStyle -> Gray] & /@ ColorData["Indexed"], 6, 6, 1, {}],
Spacings -> .25]
Some further reflections. It hit me that the colors used for the BarChart are actually some type of gradient. It seems to be a "pastel rainbow" if I can call it that. It goes from blue to red, but it's not the bright rainbow colors, and it seems to lock in the first and last colors while changing the colors of the bars in a smooth fashion according to some function (I will be trying to figure this out). You can see what I'm talking about if you plot the following: BarChart[{Range[40]}, ImageSize -> Large]
I tried matching this to one of the named gradients, but none of them match. That first bluish/purple color is not represented in any of these plots (was looking for Red and Green around 0.8 with a Blue around 1):
Plot[{ColorData[#, x][[1]], ColorData[#, x][[2]],
ColorData[#, x][[3]]}, {x, 0, 1}, PlotStyle -> {Red, Green, Blue},
PlotLabel -> #] & /@ ColorData["Gradients"]