Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have the following MWE in PSTricks:

\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-plot}
\begin{document}
  \psset{xunit=2cm,yunit=1.5cm}
  \begin{pspicture}(80,-2)(120,2)
    \savedata{\mydatasinexp}%
[{83., -1.45},{87., -1.49},{98., -1.6}, %lower row
 {83., +1.45},{87., +1.49},{98., +1.6}] %upper row

\dataplot[plotstyle=dots,linecolor=blue,
      dotsize=2.5pt]{\mydatasinexp}
        \end{pspicture}
\end{document} 

As the data points suggest, I have an upper and a lower curve. I would like to fill the area between these two curves. Is it possible to obtain this with PSTricks?

share|improve this question
    
I just asked a very similar question about MetaPost yesterday. tex.stackexchange.com/a/136735/2148 –  Dave Jarvis Oct 8 '13 at 20:41

2 Answers 2

up vote 6 down vote accepted

I do not really understand what do you mean with "curve". The order of the points is impoirtant for the filling

\documentclass{article}
\usepackage{pst-plot}
\begin{document}
  \psset{xunit=5mm,yunit=10mm}
  \begin{pspicture}(80,-2)(120,2)
    \savedata\mydatasinexp%
[{83., -1.45},{87., -1.49},{98., -1.6}, %lower row
 {83., +1.45},{87., +1.49},{98., +1.6}] %upper row
\dataplot[showpoints,linestyle=none,fillstyle=solid,
      fillcolor=blue!40,dotsize=5pt]{\mydatasinexp}
\end{pspicture}
\end{document} 

However, I suppose that you mean something like this:

\begin{pspicture}(80,-2)(120,2)
\pscustom[showpoints,linestyle=none,fillstyle=solid,
      fillcolor=blue!40,dotsize=5pt]{%
\listplot{83. -1.45 87. -1.49 98. -1.6}
\listplot[ChangeOrder]{83. 1.45 87. 1.49 98. 1.6}
}
\end{pspicture}
share|improve this answer
    
I just meant the area between the two curves spanned by lower row and upper row. But I get your point on the order of the data points, thanks. My suggestion also works, FYI, but so does yours. –  BillyJean Oct 8 '13 at 13:42
    
See my edited answer –  Herbert Oct 8 '13 at 13:43

One possibility is of course to use \pspolygon and then use the four endpoints, i.e.

\documentclass{article}
\usepackage{pstricks}
\usepackage{pst-plot}
\begin{document}
  \psset{xunit=2cm,yunit=1.5cm}
  \begin{pspicture}(80,-2)(120,2)
    \savedata{\mydatasinexp}%
\pspolygon*(83., -1.45)(83., +1.45)(98., -1.6)(98., +1.6)

\dataplot[plotstyle=dots,linecolor=blue,
      dotsize=2.5pt]{\mydatasinexp}
        \end{pspicture}
\end{document} 
share|improve this answer
1  
In its current form your answer might be not really helpful. Maybe you want to expand it a bit and elaborate more on how to use it. –  Benedikt Bauer Oct 8 '13 at 13:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.