Simple task: I would like to place two bar charts in a row and have an indicator horizontal line going above the two bar charts.

What I did:

bar1 = BarChart[{100, 75, 100}, ChartLayout -> "Stacked", 
   ChartStyle -> {Blue, Black, Blue}, Frame -> False, Axes -> False, 
   PlotLabel -> "bar1"];
bar2 = BarChart[{100, 38, 15, 38, 85}, ChartLayout -> "Stacked", 
   ChartStyle -> {Blue, Black, White, Black, Blue}, Frame -> False, 
   Axes -> False, PlotLabel -> "bar2"];
indicator = 
  Plot[-65 + 100, {x, 0, 4}, PlotStyle -> Red, 
   PlotLegends -> ToString[65]];

To combine the plots, I tried:

Show[Row[bar1, bar2], indicator]

but the result:

enter image description here

HELP ! The colors need to be the same.

This is how it should look like in the end: enter image description here

  • $\begingroup$ No, I misunderstood what you wanted. Actually, I don't know what you want. Is there some example figure out there that you could link to so that we can see what you want? $\endgroup$
    – march
    Aug 4, 2016 at 15:25
  • $\begingroup$ @march, I hope this helps. $\endgroup$
    – henry
    Aug 4, 2016 at 15:37
  • $\begingroup$ Row requires the objects to be put in a list in the first argument, like in Row[{obj1, obj2, ...}]. You miss the curly braces in your code $\endgroup$
    – glS
    Aug 4, 2016 at 15:39
  • $\begingroup$ Something like Overlay[{GraphicsRow[{bar1, bar2}],indicator}] but I am not sure where exactly you want that line to pass. $\endgroup$ Aug 4, 2016 at 15:46
  • $\begingroup$ @march add answer? $\endgroup$
    – Feyre
    Aug 4, 2016 at 16:20

1 Answer 1


Use Epilog and GraphicsRow. Something like

GraphicsRow[{bar1, bar2},
  Spacings -> -20,
  Epilog -> {Red, Thickness[0.02], Line[{{0, -180}, {750, -180}}]}

and you can change the coordinates {{0, -180}, {750, -180}} of the Line by trial and error to get what you want (that's how I usually do it). The result is

enter image description here


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.