When making a nested BoxWhiskersPlot with chart labels, the labels are nicely spaced below the bottom frame when using labels for all nested data

data = {{{61.5, 60.5, 59.5}, {65.5, 60.5, 58.5}}, {{60.5, 57, 62}, {66.5, 60.5, 56.5}}}
BoxWhiskerChart[data, ChartLabels -> {{1, 3}, {"Group1", "Group2"}}]

Nicely spaced chartlabels

However, I decided to put the labeling of the groups into ChartLegends and to remove the chart labels for the groups,

BoxWhiskerChart[data, ChartLabels -> {{1, 3}, None}, ChartLegends -> {"Group1", "Group2"}]

enter image description here

but this leaves an annoying gap between the frame and the chart labels, the numbers 1 and 3 in my example. How can I remove it?

Also, I actually would like to place the legends inside the frame at the lower left corner in order to save space, but Placed in the BoxWhiskersPlot does not allow it -- how can I work around that?

Any help is much appreciated!

  ChartLabels -> 
   {Placed[Pane[#, FrameMargins -> {{0, 0}, {0, -20}}] & /@ {1, 3}, Axis],  None},  
  ChartLegends -> Placed[{"Group1", "Group2"}, {Scaled[{.15, .1}]}]]

enter image description here


A dirty one (Deleting the extra "\n"):

BoxWhiskerChart[data, ChartLabels -> {{"float1", "float3"}, None}, 
  ChartLegends -> {"Group1", "Group2"}] /. 
   {"\n\!\(\"float1\"\)" :> "\!\(\"1\"\)", 
    "\n\!\(\"float3\"\)" :> "\!\(\"3\"\)"}

Mathematica graphics


Your Answer

