Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a BarChart (Mathematica 9.0.1)

BarChart[{1, 2, 3},
ChartLabels -> (Rotate[Text[Style[#, FontSize -> Scaled[0.05]]], -Pi/2]
& /@{abcdabcd,abcdabcd, abcdabcd})]

enter image description here

and would like to add a vertical label to the y-axis. I tried

BarChart[{1, 2, 3},
ChartLabels -> (Rotate[Text[Style[#, FontSize -> Scaled[0.05]]], -Pi/2]
& /@ {abcdabcd, abcdabcd, abcdabcd}),
FrameLabel -> {None, "y-axis"},
Frame -> {False, True, False, False}]

and it's perfect except for a gap between the two axes (which is somehow extremely ugly with the actual data):

enter image description here

I tried using Labeled, but then the label is positioned too low (i want it at the center of the y-axis):

Labeled[BarChart[{1, 2, 3},
ChartLabels -> (Rotate[Text[Style[#, FontSize -> Scaled[0.05]]], -Pi/2]
& /@ {abcdabcd, abcdabcd, abcdabcd})],
{Rotate[Style["y-axis", FontFamily -> "Helvetica"], Pi/2]}, {Left}]

(Can't post > 2 links)

Any help would be most appreciated!

share|improve this question
Welcome, Stefan. I embedded the images for you. The image/link limitation is an anti-spam measure that will be lifted once you start using the site more. – Mr.Wizard May 18 '13 at 14:07
@Silvia: If I try that, the gap is gone, but so is the label ('y-axis'). – Stefan Ca May 18 '13 at 17:24
Oops, you're right. Sorry for my oversight.. – Silvia May 18 '13 at 17:42
up vote 1 down vote accepted

In your second attempt (which results in the gap), you can remove the gap by eliminating the PlotRangePadding for the x-axis.

PlotRangePadding -> {0, 0}
share|improve this answer
You're right, that's even a bit simpler than Mr. Wizards solution. – Stefan Ca May 18 '13 at 17:28
@Stefan For what it's worth the output (from this) looks a bit different on version 7, and the longer code was required to match your output. Also, I believe you should be able to use the slightly shorter PlotRangePadding -> 0 to produce the same output as given by PlotRangePadding -> {0, 0}. – Mr.Wizard May 19 '13 at 5:52

This feels a lot more complicated than it should be, but I think at least it works:

BarChart[{1, 2, 3},
 ChartLabels ->
  (Rotate[Text[Style[#, FontSize -> Scaled[0.05]]], -Pi/2] & /@ {abcdabcd, abcdabcd, abcdabcd}),
 FrameLabel -> {None, "y-axis"},
 Frame -> {1, 1, 0, 0},
 FrameTicks -> {None, All},
 PlotRangePadding -> {0.1, 0}

enter image description here

share|improve this answer
Thank you very much! It's exactly what a needed. – Stefan Ca May 18 '13 at 14:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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