I want to be able to display the sum of the values on top of the bars. Below is my code and under that, an illustrated image that displays the values I want to show. Can this be done?

    ybar stacked,
    bar width=15pt,
    nodes near coords,
    legend style={at={(0.5,-0.15)},
      anchor=north,legend columns=-1},
    ylabel={Seconds (s)},
    symbolic x coords={t1, t2, t3, t4},
    x tick label style={rotate=41,anchor=east},
\addplot+[ybar] plot coordinates {(t1, 70) (t2, 94) (t3, 70) (t4, 70)};
\addplot+[ybar] plot coordinates {(t1, 43) (t2, 43) (t3, 61) (t4, 71)};
\legend{\strut d1,\strut  d2,\strut  d3}

https://i.imgur.com/qPaYiKD.jpg \n



makes it so that the values reside inside the bars. Without it, a sum of values are stacked on top of the bars. I do however want the sum at the top, then the value of each bar displayed inside of them, just as in the illustration.

Your Answer

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

Browse other questions tagged or ask your own question.