[pstricks] Shading the area between two \listplots
Herbert Voss
LaTeX at zedat.fu-berlin.de
Wed May 25 07:40:07 CEST 2005
Alan Ristow wrote:
> I am plotting two curves using the psgraph environment and I would
> like to shade the area between the curves. I feel certain that I have
> done this before, but I cannot figure out how. At any rate, I have a
> minimal example below that produces two graphs: One with the two lines
> and no shading, and one with my (rotten) attempt to shade the area
> between the lines.
>
> The problem appears to be that I cannot draw a closed path using
> \listplot. I suppose that a workaround might be to draw the data from
> two different files, plotting the second set of data in reverse order
> from the first. However, I would prefer to avoid that, if possible. Is
> this possible?
> % Shade the area between lines
> \begin{psgraph}[axesstyle=frame,ticklinestyle=dotted,xticksize=0 10,%
> yticksize=0 10](0,0)(10,10){1.75in}{1.1in}%
> \readdata{\data}{data.dat}%
> \pscustom[fillstyle=solid,fillcolor=gray]{%
> \listplot[plotNo=1,plotNoMax=2]{\data}%
> \listplot[plotNo=2,plotNoMax=2]{\data}%
> }%
> \end{psgraph}
> \end{document}
% Shade the area between lines
\begin{psgraph}[axesstyle=frame](0,0)(10,10){1.75in}{1.1in}%
\readdata{\data}{data.dat}%
\pscustom[fillstyle=solid,fillcolor=gray]{%
\psline(0,0)(0,1) % dummy lines for filling
\listplot[plotNo=2,plotNoMax=2]{\data}%
\psline(10,1)(10,0)} % dummy lines for filling
\pscustom[fillstyle=solid,fillcolor=white]{%
\psline(0,0)(0,1) % dummy lines for filling
\listplot[plotNo=1,plotNoMax=2]{\data}%
\psline(10,1)(10,0)} % dummy lines for filling
\psgrid[griddots=5,gridlabels=0pt,subgriddiv=0,gridcolor=gray]
\end{psgraph}
Herbert
More information about the PSTricks
mailing list