I have a dataset that has a number of groups with overlapping sets. There is a point in the group within the intersection of the sets that I want to highlight by placing a marker of that point between the sets in the group.
I want to do use BoxWhiskerChart
to show the distribution of the groups and place the marker between the plots in the group. The problem is that I have not been able to figure out where the box plots will be centered in the chart. Or better the x-axis range that each box plot occupies. This is further complicated by the fact that the locations change significantly as the BarSpacing
option changes.
Is there a way to get the x-axis range that each box plot occupies in a BoxWhiskerChart
(or at least the centre of each box plot) as the BarSpacing
option varies?
This is a reasonable example of the problem I am trying to solve. Notice how the highlighted points do not line appear between the group box plots and jump around as BarSpacing
is changed. I'd really like to use the Method -> {"BoxWidth" -> "Scaled"}
option but I can't even get the fixed width option to work yet.
(*group dataset*)
data = Table[RandomVariate[
NormalDistribution[RandomInteger[5], 1.5], 100],{3}, {2}];
(*get intersections and point within intersection for example*)
minsAndMaxes = Map[{Min[#], Max[#]} &, data, {2}];
groupIntersections =
Map[IntervalIntersection[Interval@#[[1]], Interval@#[[2]]] &,
minsAndMaxes, {1}];
displayPoints = RandomReal[{Min[#], Max[#]}] & /@ groupIntersections;
(*Show issue with Epilog and BarSpacing in Manipulate*)
Manipulate[BoxWhiskerChart[data,
ChartLabels -> {{"2002", "2001", "2000"}, None},
BarSpacing -> {within, between},
Epilog -> {Green, Opacity[.6], PointSize[.02],
MapIndexed[
Tooltip[Point[{First@#2 2 - .5, #1}], NumberForm[#1, {2, 1}]] &,
displayPoints]}],
{{within, Tiny}, {Tiny, Medium, Large}},
{{between, Medium}, {Tiny, Medium, Large}}]
Thanks.