# [pstricks] shading area under a curve

Herbert Voss LaTeX at zedat.fu-berlin.de
Fri Apr 6 23:25:15 CEST 2007

Derek Collis schrieb:
> Herbert,
>
> I do subscribe to the list and I have your 3 and 4 Ed of PSTricks;
> however, neither have helped me. All the examples that I've seen, and
> the one you suggested, do not answer my question.
>
> I want to sketch y=x^2 over, say, -3 to 3, however, I only want the
> region between x=1 and x=2 under the parabola shaded.

\documentclass{article}
\usepackage{pst-plot}
\pagestyle{empty}
\begin{document}

\begin{center}
\begin{displaymath}
f(x)=x^2
\end{displaymath}

\begin{pspicture}(-3.5,-.5)(3.5,9.5)
\psplot{-3}{3}{x x mul}
\pscustom[fillstyle=solid,fillcolor=cyan]{%
\psline(1,0)(1,1)
\psplot{1}{2}{x x mul}
\psline(2,4)(2,0)}
\psaxes{->}(0,0)(-3.5,0)(3.5,9)
\end{pspicture}
\end{center}

\end{document}

Herbert