I am generating a bar chart in which each count is to be represented by a disk (or something similar). This alone seems straightforward: simply set the option ChartElements -> Graphics@Disk[]
. But alas, it's not perfect, as shown by the following example:
BarChart[#, ChartElements -> Graphics@Disk[],
ChartLabels -> {"bin " /@ #}, FrameLabel -> {"Bins", "Counts"},
LabelStyle -> Directive[Black, Larger], PlotTheme -> "Detailed",
ImageSize -> Large] &@Range[8]
The first column should contain one whole disk. The second column should contain two whole disks, so on and so forth. This can be corrected by setting ChartElements -> {Graphics@Disk[], {1, 1}}
, which produces
But notice how each column of disks is now off-center from its frame tick and label. This becomes far more evident as the number of counts increases; for example, when the charted values are squared:
I tried re-centering the labels under the columns of disks by changing ChartLabels -> Placed["bin " /@ #, {{0.39, 0}, {1, 1.5}}]
, which produced the following result:
The labels are now smaller and apparently invisible to FrameLabel
, which overlaps them! I suppose that may be corrected by wrapping another Placed
around the horizontal frame label, but all of this fine-tuning could be avoided in the first place if I can just get the disks to remain centered within thier columns.
So, is there a way to do that?
(Wrapping Placed
around the disks themselves didn't work...)
Thanks!
$Version
, I'm using12.1.1 for Microsoft Windows (64-bit) (June 19, 2020)
But it works fine for you? Can you demonstrate? Is there a newer (or older) version of 12.1? $\endgroup$