I am creating a custom ChartElementFunction for BoxWhiskerChart. I would like to access the box-and-whisker specifications from the second parameter of BoxWhiskerChart to use in the custom function; just as the built-in element functions. Minimal custom element function:
ClearAll[cef];
cef[boundingBox_, data_, meta_] :=
Module[{qt = Quantile[data, {0, 0.25, .5, 0.75, 1}, {{1/2, 0}, {0, 1}}],
h = First@Differences@boundingBox[[2]],
m = Mean@boundingBox[[2]]},
{
{Thickness[.005], CapForm["Butt"], Blue,
Line[{
{qt[[1]], m - .1 h},
{qt[[1]], m + .1 h}}]},
{Thickness[.005], CapForm["Butt"], Magenta,
Line[{
{qt[[5]], m - .1 h},
{qt[[5]], m + .1 h}}]}
}
]
Minimal example where the fences are drawn different colours. The box-and-whisker "Fences" specification says to draw them 80% of the height of the box-whisker. However, I don't have access to this and have to hard-code a value (in this case 20% of the height). The regular element function is added to cut down on the size of the post.
SeedRandom[953];
data = RandomVariate[ChiSquareDistribution[5], 100];
BoxWhiskerChart[data, {"Basic", {"Fences", .8, None}},
BarOrigin -> Left,
ChartElementFunction -> ({cef[##], ChartElementDataFunction["BoxWhisker"][##]} &)]
Can the second parameter box-and-whisker specifications be accessed in a custom ChartElementFunction as they are in the built-in ones? I would prefer not to move the specifications into a parameter of the custom function.


{"Basic", {"Fences", .8, None}}argument toBoxWhiskerChartjust asChartElementDataFunction["BoxWhisker"]accesses it and knows to useNoneas the style of the fences (which is why there are no 80% height fences in the chart). – Edmund Jul 25 '16 at 22:17Spelunkingpackage installed? It looks like you can get an understanding for the internals viaSpelunk[Charting`iBoxWhiskerChart]– Jason B. Jul 25 '16 at 22:25