This question already has an answer here:

I'm looking for a way to illustrate Trapezoidal rule. I've seen this code to illustrate Riemann sums (Riemann sum with pgfplots -- can't seem to make graph look right) but I don't see how to adapt it.




        axis lines=middle,
        axis on top

\addplot [draw=red, fill=red!10, ybar interval, samples=9, domain=1:17]
\addplot [draw=green, fill=green!10, ybar interval, samples=9, domain=17:1]

\addplot[smooth, thick,domain=1:17,samples=40]{x^-1};


Do you have any suggestion ?

marked as duplicate by CroCo, gernot, Community Jan 28 '17 at 11:35

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Yes ! Thank you very much (I didn't had the english word Trapezium :-S) – Yoshi Jan 28 '17 at 11:35

Browse other questions tagged or ask your own question.