2
$\begingroup$

I have used Placed[Before] to place labels on the labels before the bars, but when I specify a plot range, the labels disappear. I need a solution wherein I can use PlotRange and Placed[Before] without the labels disappearing.

$\endgroup$
4
  • 2
    $\begingroup$ Please edit your post by inserting a image of a plot that shows your problem. Also, include the Mathematica code that produced the plot. This will help others to help you. $\endgroup$
    – m_goldberg
    Commented Dec 14, 2012 at 17:29
  • $\begingroup$ @m_goldberg do they have enough rep for that? $\endgroup$
    – cormullion
    Commented Dec 14, 2012 at 18:33
  • $\begingroup$ @cormullion No, but they can give URL to image that someone with higher rep can edit to display inline. Very odd restriction in the first place in my opinion. m_goldberg: I think you needed higher rep :) $\endgroup$
    – ssch
    Commented Dec 14, 2012 at 19:23
  • $\begingroup$ @cormullion. That slipped my mind. If it hadn't, I would have only asked for code. $\endgroup$
    – m_goldberg
    Commented Dec 15, 2012 at 1:28

1 Answer 1

4
$\begingroup$

You need to change setting of the option ImagePadding. With default setting for ImagePadding, labels are cut out:

 BarChart[{1, 2, 3}, 
 ChartLabels -> Placed[{"label1", "label2", "label3"}, Before], 
    BarOrigin -> Left, Ticks -> None, PlotRange -> {{0, 3}, All}]

enter image description here

 BarChart[{1, 2, 3}, 
  ChartLabels -> Placed[{"label1", "label2", "label3"}, Before], 
  BarOrigin -> Left, Ticks -> None, PlotRange -> {{0, 3}, All}, 
  ImagePadding -> 30]

enter image description here

If you wish, you can pad only the side you need by setting the padding values for other sides to Automatic:

 BarChart[{1, 2, 3}, 
   ChartLabels -> Placed[{"label1", "label2", "label3"}, Before], 
   BarOrigin -> Left, Ticks -> None, PlotRange -> {{0, 3}, All}, 
   ImagePadding -> {{30, Automatic}, {Automatic, Automatic}}]
$\endgroup$

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.