If I have a ybar stacked axis type, how can I add another plot such as a jump plot on top?

The example below shows more or less what I need:

mixed stacked bar plot


You can switch off the stacking for a single plot by using stack plots=false:




colormap={whitered}{color(0cm)=(white); color(1cm)=(orange!75!red)}

    ybar stacked,
    set layers
\addplot +[white, draw=black] {rnd};
\addplot +[gray!50, draw=black] {rnd};
\addplot [
    very thick, red!75!black,
    const plot,
    stack plots=false,
    on layer=axis foreground
] {rnd};
  • Answered in no time, thanks Jake! Also answered question 115152 for me. – skvery May 21 '13 at 15:29
  • 1
    @user1831847: Pleasure! However, tex.stackexchange.com/questions/115152/… is still open, because this approach only works if the const plot has the same number of coordinates as the stacked plots (which is really a bug, I believe, because once we set stack plots=false, the number of coordinates shouldn't matter). – Jake May 21 '13 at 15:44
  • I agree with you that it should reset the number of coordinates as well. Maybe stack plots=reset? – skvery May 21 '13 at 18:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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