I have the following BarChart with labels on the bars and labels at the bottom:
data = {0.55`, 0.19`, 0.21`, 0.94`, 0.79`, 0.07`, 0.82`, 0.12`, 0.15`,
1.`, 0.15`, 0.12`, 0.76`, 0.8`, 0.069`, 0.71`};
labelsBar = {0.305`, -0.151`, 0.162`,
0.62`, -0.363`, -0.054`, -0.323`, 0.12`, 0.024`, -0.509`, -0.027`,
0.016`, 0.403`, 0.314`, -0.005`, -0.221`};
labelsBottom = {"ABC1", "ABC2", "ABC3", "ABC4", "ABC5", "ABC6",
"ABC7", "ABC8", "ABC9", "ABC10", "ABC11", "ABC12", "ABC13",
"ABC14", "ABC15", "ABC16"};
BarChart[data,
ChartLabels -> Placed[{labelsBar, labelsBottom}, {Top, Axis}],
LabelStyle -> {Black},
ChartStyle ->
Table[If[labelsBar[[x]] < 0, Red, Blue], {x, 1, Length@labelsBar}],
ImageSize -> 600]
I'm trying to format the labels differently, i.e. the labels on the bottom need to be rotated 90 degrees and should have a different style than the labels on the bars. Moreover, I want the labels on the bars be above them.
I tried using Directive
to also rotate the bottom labels, but that gives me an error:
BarChart[data,
ChartLabels ->
Placed[{labelsBar, labelsBottom}, {Top,
Directive[Axis, Rotate[#, Pi/2] &]}], LabelStyle -> {Black},
ChartStyle ->
Table[If[labelsBar[[x]] < 0, Red, Blue], {x, 1, Length@labelsBar}],
ImageSize -> 600]
Also coloring the labels differently with Labelstyle
seems not to be the correct approach, since now both labels are green and none is black:
BarChart[data,
ChartLabels -> Placed[{labelsBar, labelsBottom}, {Top, Axis}],
LabelStyle -> {Black, Green},
ChartStyle ->
Table[If[labelsBar[[x]] < 0, Red, Blue], {x, 1, Length@labelsBar}],
ImageSize -> 600]
I must be missing something and hope for some help.