[pstricks] Shading the area between two \listplots

Alan Ristow ristow at ece.gatech.edu
Wed May 25 04:41:43 CEST 2005


Hi,

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?

Here is my example file:

\documentclass{article}
\usepackage{pstricks}
\usepackage{pstricks-add}
\usepackage{filecontents}

\begin{filecontents}{data.dat}
  0 3 8
  2 4 7
  5 5 5.5
  7 3.5 5
  10 2 9
\end{filecontents}

\pagestyle{empty}
\listfiles

\begin{document}

   % Plot lines without shading
   \begin{psgraph}[axesstyle=frame,ticklinestyle=dotted,xticksize=0 10,%
       yticksize=0 10](0,0)(10,10){1.75in}{1.1in}%
     \readdata{\data}{data.dat}%
     \listplot[plotNo=1,plotNoMax=2]{\data}%
     \listplot[plotNo=2,plotNoMax=2]{\data}%
   \end{psgraph}
   %
   \hspace*{1in}%
   %
   % 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}

  *File List*
  article.cls    2004/02/16 v1.4f Standard LaTeX document class
   size10.clo    2004/02/16 v1.4f Standard LaTeX file (size option)
pstricks.sty    2004/05/12 v0.2l LaTeX wrapper for `PSTricks' (RN,HV)
pstricks.tex    2004/06/22 v1.04 `PSTricks' (tvz)
   xcolor.sty    2005/03/24 v2.02 LaTeX color extensions (UK)
    color.cfg    2003/03/08 v1.0 MiKTeX 'color' configuration
    dvips.def    1999/02/16 v3.0i Driver-dependant file (DPC,SPQR)
pstricks-add.sty    2004/07/18 package wrapper for pstricks-add.tex (hv)
pstricks-add.tex    2005/02/20 v2.37 `PSTricks-add' (hv)
pst-xkey.tex    2005/02/22 v1.5 PSTricks specialization of xkeyval (HA)
  xkeyval.sty    2005/03/31 v2.4 package option processing (HA)
  xkeyval.tex    2005/03/31 v2.4 key=value parser (HA)
filecontents.sty    2004/08/16 v1.1 Create an external file from within 
a LaTeX
  document
  ***********

_________________________________________________
Alan Ristow                <ristow at ee.gatech.edu>
University Center of Excellence for Photovoltaics
Georgia Institute of Technology
Atlanta, Georgia

Phone: +1-404-894-0336
Fax:   +1-404-894-4832




More information about the PSTricks mailing list