[pstricks] Area under a Function

Claus Behl claus at bempf.de
Tue Sep 28 20:38:44 CEST 2004


Claus Behl wrote:

> Hi,
> is it possible to fill the area indicating the integral from 1 to 3 
> under the graph of f.
> I want to fill the area under a curve with color. I draw the curve 
> with a psplot command.
> \psplot[]{-0.5}{4}{x 2 exp 0.25 mul 1 add}.
>
> Claus Behl
>
> _______________________________________________
> pstricks mailing list
> pstricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
>
Sorry for this question. The Solution is \pscustom:
Example:
%%%% Funktion %%%%
\def\HelpF{}
\def\F{x 0.5 mul 1 add \HelpF}
%%%%%%%%%%%%%%%%%%%%%%%%%
\psset{unit=0.8cm}
\begin{pspicture}(-0.5,-0.5)(9,5)
\SpecialCoor
%% Fläche unter dem Graph
\pscustom[linestyle=none,fillstyle=solid, fillcolor=lightgray]{%
\psplot{0}{2}{\F}
\pscurve[liftpen=1](2,0)(2,0)(1,0)(0,0)
}
%% Funktion
\psplot{0}{8}{\F}
\uput[0](3.5,4){$y=f(x)$}
%% Ende Funktion
\psline[linestyle=dashed](2,0)(2,2)
\psline[linestyle=dashed](4,0)(4,3)
\psline[linestyle=dashed](8,0)(8,5)
%% Koordinatensystem
\psaxes[]{->}(9,5)
\uput[-90](9,0){x}
\uput[0](0,5){y}
%% Ende Koordinatensystem
\end{pspicture}

Claus




More information about the PSTricks mailing list