2

I know how to use pscustom to fill the area between two curves but how can I fill only, say, a rectangle below part of a curve plotted with a .dat file?

What I did was to generate two .dat files, one with my curve and other with a line on x-axis, which I called the groundData.

\readdata{\data}{data.dat}
\readdata{\groundData}{groundData.dat}


\pscustom[fillstyle=solid,fillcolor=blue,linestyle=none]{
\listplot[plotNo=2,plotNoMax=6]{\data}
\listplot[ChangeOrder]{\groundData}}
}

Since the data.dat file have information on several curves the plotNo and plotNoMax options help to pick the correct one. When I do this, instead of a rectangle below part of the curve (the part over the segment of line on the x-axis) I get two triangles with touching vertices as if the last point of data.dat was being connected to the first point in groundData.dat. The changeorder option was supposed to take care of this but it seems to have the same effect as if it was not there.

Can you help me? Thank you.

  • We might try to help, if we had the data files and a full compilable code… – Bernard Mar 5 '17 at 23:43
1

You can use some of the \listplot parameter:

\listfiles
\documentclass{article}
\usepackage{pst-plot}
\begin{document}
\readdata\data{data.data}
\psset{xunit=12.5cm,yunit=0.2mm}
\begin{pspicture}(-0.080,-30)(1,270)
\pstScalePoints(1,1){1000 div}{1000 div}
\psaxes[Dx=200,dx=2.5cm,Dy=100,ticksize=0 5pt,tickstyle=inner,
    subticks=10,ylabelFactor=\cdot10^3,dy=2cm](0,0)(1,250)
\pscustom[fillstyle=solid,fillcolor=blue,opacity=0.4,linestyle=none,linecap=2]{%
  \psline(0.2,0)(0.2,10)% 10 is only a guess
  \listplot[xStart=200,xEnd=800]{\data}
  \psline(0.8,10)(0.8,0)
}
\listplot[linewidth=1pt,linecolor=blue]{\data}
\end{pspicture} 

\end{document}

enter image description here

With linecap=2 there is drawn a straight line from (0.2,10) to the value of the data. And the same for the right side from data end to (0.8,10)

The data file is part of your TeX installation. It uses values from 0..994 for x and 0..256500 for y. Should be simply adopted to your data area.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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