I am trying to generate a horizontal bar chart which is centered at zero. Currently what I have is this:
And the code that I am using is:
BarChart[{{0.91, 0.87}, {-0.3, -0.27}, {0.1, 0.05}, {0.95, 1}},
BarOrigin -> Left, BarSpacing -> {0, 1.5},
PlotLabel ->
Style["Stokes", Black, Bold, FontSize -> 15, FontFamily -> font],
ChartStyle -> {LightRed, LightBlue}, PlotRange -> {-1, 1},
AxesOrigin -> {0, 0}, ChartLegends -> {"Measured", "Generated"},
ChartLabels -> {Placed[{Style["S3", Black, Bold, FontSize -> 15,
FontFamily -> font],
Style["S2", Black, Bold, FontSize -> 15, FontFamily -> font],
Style["S1", Black, Bold, FontSize -> 15, FontFamily -> font],
Style["DOP", Black, Bold, FontSize -> 15, FontFamily -> font]},
Above], Placed[{}, Top]},
LabelingFunction -> (Placed[Rotate[#, 0* Pi],
If[Abs[#1] > 0.5, Right, {{1, 0}, {-0.2, 0}}]] &)]
I would like to make a couple of modifications. First of all, I would like to create a gap between the x-axis and -x-axis and place the labels corresponding to each group (like DOP, S1 etc) in the middle. Furthermore, currently, I manually change the location of the data labels for bars which are too short, but how can I automatically position the data labels such that they don't overlap with the bars if bars are too short? Thanks!