6

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?

1

2 Answers 2

6

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}
2
  • 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, 2013 at 13:42
  • See my edited answer
    – user2478
    Oct 8, 2013 at 13:43
3

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} 
1
  • 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. Oct 8, 2013 at 13:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .