2
$\begingroup$

The "ColorScheme"of a DistributionChart can be changed using the ChartElementFunction like in the following example:

SeedRandom["DistributionChart"];
data = RandomReal[NormalDistribution[], {100}];

DistributionChart[data, 
  ChartElementFunction -> 
  ChartElementData["SmoothDensity", "ColorScheme" -> "DeepSeaColors"]]

enter image description here

But the "ColorScheme"seems to get irgnored if I change "SmoothDensity" for "DensityQuantile"

I tried to change the colors using ChartStyle but I only got the following, unsatisfactory result.

DistributionChart[data, ChartStyle -> "DeepSeaColors", 
 ChartElementFunction -> ChartElementData["DensityQuantile"]]

enter image description here

$\endgroup$
2
$\begingroup$

Actually, ChartStyle does work, but it does not apply the whole colour range to the first bar.

This example, slightly modified from the documentation, shows what is actually going on.

Table[DistributionChart[data, ChartElementFunction -> f, 
  ChartStyle -> "DeepSeaColors"], {f, {"Quantile", "DensityQuantile", 
   "FadingQuantile", "GlassQuantile"}}]

enter image description here

Or even more simply:

DistributionChart[data, ChartStyle -> Darker@Blue, 
 ChartElementFunction -> ChartElementData["DensityQuantile"]]

enter image description here

To get something more like what you want will be tricky because "DensityQuantile" uses Opacity to make the outlying parts lighter, not darker as in the example for "SmoothDensity".

Although there are many other sub-options for these styles, not all well-documented, I couldn't find an obvious solution. This was the best I could do to get darker bands in the middle.

DistributionChart[data, ChartStyle -> ColorData["DeepSeaColors"], 
 ChartElementFunction -> 
  ChartElementData["Quantile", "Quantile" -> 8, 
   "QuantileShading" -> True]]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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