This is the bar chart. I need to remove the overextensions of the bar lines, reduce the space between consecutive A,B,C,D. However, I also want to retain/ add space between the three groups of A-B-C-D

BarChart[{{0.41, 0.70, 0, 0.52}, {0.09, 0.09, 1.2, 0.39}, {0.04, 0, 
   1.3, 0.38}}, ChartLabels -> {"A", "B", "C", "D"}]

enter image description here


1 Answer 1


Trawling through the documentation of BarChart

 {{0.41, 0.70, 0, 0.52}, {0.09, 0.09, 1.2, 0.39}, {0.04, 0, 1.3,0.38}},
 ChartLabels -> {"A", "B", "C", "D"},
 TicksStyle -> Opacity[0],(*remove tick marks near labels*)
 LabelStyle -> Opacity[1],(*keep labels*)
 BarSpacing -> {None,Large} (* {distance between bars, distance between groups}*)



As highlighted by Domen in the comments TicksStyle -> {Opacity[0], Automatic} might be a better solution as I have also stripped the tickmarks on the y-axis

  • 3
    $\begingroup$ Note that this also removes ticks on the y axis, which might not be desirable. TicksStyle -> {Opacity[0], Automatic} might be a better solution. $\endgroup$
    – Domen
    Commented Mar 22, 2023 at 13:21
  • 1
    $\begingroup$ Thanks @Domen, I failed to notice that and can imagine being frustrated later on as to why they were missing! I will edit the post to highlight your comment $\endgroup$ Commented Mar 23, 2023 at 3:47
  • 2
    $\begingroup$ TicksStyle -> {LineOpacity -> 0, Automatic} gives the desired result without having to specify LabelStyle. $\endgroup$
    – kglr
    Commented Mar 23, 2023 at 20:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.