2
$\begingroup$

Within BarChart is there a way to increase the length of the horizontal axis in order for me to be able to fit in a description on the right side? Below is an example where I used another bar with the value(s) 0 so that my description has some space on the side. However, I am sure there is a real solution to that.

BarChart[{{3, 2}, {0, 0}}, 
  ChartLayout -> "Stacked", 
  Epilog -> 
    {Red,
     braceLabel[{{1.6, 4}, {1.6, 2}}, Style["label", Larger], .02], 
     Dashed, Line[{{0.5, 4}, {1.55, 4}}], Dashed, Line[{{0.5, 2}, {1.55, 2}}]}]

enter image description here

$\endgroup$
1
  • $\begingroup$ Your definition for bracelevel is missing. $\endgroup$
    – Yves Klett
    May 2, 2017 at 15:12

2 Answers 2

1
$\begingroup$

I recommend using PlotRangePadding to enlarge the plot viewport to include the graphics specified in the epilog.

BarChart[{3, 2},
  ChartLayout -> "Stacked",
  PlotRangePadding -> {{Automatic, .55}, .2},
  Epilog -> {Red, EdgeForm[{Thick, Black}], Rectangle[{1.55, 2}, {2.05, 4}]}]

chartenter image description here

$\endgroup$
2
$\begingroup$

Use PlotRange. You did not include your definition of braceLabel

BarChart[{3, 2},
 ChartLayout -> "Stacked",
 Epilog -> {Red, Dashed,
   Line[{{0.5, 4}, {1.55, 4}}],
   Line[{{0.5, 2}, {1.55, 2}}]}, 
 PlotRange -> {{0.5, 2.5}, Automatic},
 Frame -> {{True, False}, {True, False}}]

enter image description here

$\endgroup$
1
  • $\begingroup$ ty m_goldberg and bob hanlon. both answers work very well! $\endgroup$
    – onion
    Apr 30, 2017 at 7:15

Your Answer

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

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