[pstricks] psclip, psframe and area between two curves

Herbert Voss LaTeX at zedat.fu-berlin.de
Sun Apr 8 17:37:36 CEST 2007


Derek Collis wrote:
> Hi,
>
> Can someone tell me why the first set of commands shades the area 
> between the two curves, yet the second only shades the region between 
> y=1 and y=4? The only difference is ftnA which changes from -x2 + 4 to 
> -x2 + 5, but it is still in the bounds of the psframe, or so I thought...
>
>   
the first one works ,because 2^2=4 is the maximum of the function.
but in the second case 2^2<5! Choose an interval of -3...3 and
everything is okay.

\documentclass[12pt]{article}

\usepackage{pstricks-add}
\def\ftnA{x 2 exp}
\def\ftnB{x 2 exp neg 5 add}

\begin{document}

\begin{pspicture}(-2,-0.5)(2,6)
  \begin{psclip}{%
    \psplot[linestyle=none]{-3}{3}{\ftnA}
    \psplot[linestyle=none]{3}{-3}{\ftnB}}
    \psframe*[linecolor=blue](-2,0)(2,5)
  \end{psclip}
  \psaxes[subticks=0,labelFontSize=\footnotesize]{->}(0,0)(-2,-0.5)(2,6)
  \psplot{-2}{2}{\ftnA}
  \psplot{-2}{2}{\ftnB}
\end{pspicture}

\end{document}


Herbert



More information about the PSTricks mailing list