Message Boards Message Boards

0
|
1415 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

[Solved] How to display a Barchart ChartLabels below the x-Axis with one group of data

Posted 11 months ago

Hello

The code below works as expected with 2 groups of data, `ChartLabels show up below the x-axis as expected

  BarChart[{{2, 3, 5}, {10, 20, 30}}, ChartLegends -> {"L1", "L2"}, 
  ChartLabels -> {Placed[{S1, S2}, Axis, Style[#, Bold, 12, Black] &], 
   None},
 LabelingFunction -> (Placed[Style[Row[{#}], Bold, Red], Above] &)]

But with one group of data only I am not able to add a `ChartLabels anymore below the single group on the X-axis (here S1). Nothing shows up.

BarChart[{2, 3, 5}, ChartLegends -> {"L1"}, 
ChartLabels -> {Placed[{S1}, Axis, Style[#, Bold, 12, Black] &], 
None},
LabelingFunction -> (Placed[Style[Row[{#}], Bold, Red], Above] &)]

What is the solution?

Attachments:
POSTED BY: Jan Potocki
Posted 11 months ago

Possible solution: remove None (now we see "S1", but in wrong place)
and add empty string:

BarChart[{2, 3, 5}, ChartLegends -> {"L1"},
 ChartLabels -> {Placed[{"", "S1"}, Axis, 
    Style[#, Bold, 12, Black] &]}, 
 LabelingFunction -> (Placed[Style[Row[{#}], Bold, Red], Above] &)]
POSTED BY: Denis Ivanov
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract