The code from Jake's answer to Timing and integration with TikZ PGFlots discusses the mid-point rule. It can be tweaked to use right hand sums, and left hand sums.
% right hand sums
\pgfplotsset{
right segments/.code={\pgfmathsetmacro\rightsegments{#1}},
right segments=3,
right/.style args={#1:#2}{
ybar interval,
domain=#1+((#2-#1)/\rightsegments):#2+((#2-#1)/\rightsegments),
samples=\rightsegments+1,
x filter/.code=\pgfmathparse{\pgfmathresult-((#2-#1)/\rightsegments)}
}
}

% left hand sums
\pgfplotsset{
left segments/.code={\pgfmathsetmacro\leftsegments{#1}},
left segments=3,
left/.style args={#1:#2}{
ybar interval,
domain=#1:#2,
samples=\leftsegments+1,
x filter/.code=\pgfmathparse{\pgfmathresult}
}
}

and, finally, a complete MWE
\documentclass{article}
\usepackage{pgfplots}
% mid-point rule
\pgfplotsset{
midpoint segments/.code={\pgfmathsetmacro\midpointsegments{#1}},
midpoint segments=3,
midpoint/.style args={#1:#2}{
ybar interval,
domain=#1+((#2-#1)/\midpointsegments)/2:#2+((#2-#1)/\midpointsegments)/2,
samples=\midpointsegments+1,
x filter/.code=\pgfmathparse{\pgfmathresult-((#2-#1)/\midpointsegments)/2}
}
}
% right hand sums
\pgfplotsset{
right segments/.code={\pgfmathsetmacro\rightsegments{#1}},
right segments=3,
right/.style args={#1:#2}{
ybar interval,
domain=#1+((#2-#1)/\rightsegments):#2+((#2-#1)/\rightsegments),
samples=\rightsegments+1,
x filter/.code=\pgfmathparse{\pgfmathresult-((#2-#1)/\rightsegments)}
}
}
% left hand sums
\pgfplotsset{
left segments/.code={\pgfmathsetmacro\leftsegments{#1}},
left segments=3,
left/.style args={#1:#2}{
ybar interval,
domain=#1:#2,
samples=\leftsegments+1,
x filter/.code=\pgfmathparse{\pgfmathresult}
}
}
\begin{document}
% left hand sums
\begin{tikzpicture}[/pgf/declare function={f=4/x;}]
\begin{axis}[
xmin=0,xmax=9,ymin=0,ymax=4,
domain=0:10,
samples=100,
axis lines=middle
]
\addplot [thick, red] {f};
\addplot [
black!80,fill=green,opacity=.3,
left segments=7,
left=1:8
] {f};
\end{axis}
\end{tikzpicture}
% right hand sums
\begin{tikzpicture}[/pgf/declare function={f=4/x;}]
\begin{axis}[
xmin=0,xmax=9,ymin=0,ymax=4,
domain=0:10,
samples=100,
axis lines=middle
]
\addplot [thick, red] {f};
\addplot [
black!80,fill=green,opacity=.3,
right segments=7,
right=1:8,
] {f};
\end{axis}
\end{tikzpicture}
% mid point
\begin{tikzpicture}[/pgf/declare function={f=4/x;}]
\begin{axis}[
xmin=0,xmax=8,ymin=0,ymax=4,
domain=0:10,
samples=100,
axis lines=middle
]
\addplot [thick,red] {f};
\addplot [
black!80,fill=green,opacity=.3,
midpoint segments=7,
midpoint=1:8,
] {f};
\end{axis}
\end{tikzpicture}
\end{document}