[pstricks] excluding data region with correction of axes tick labels

Patrick Drechsler patrick.drechsler at gmx.net
Tue Jun 8 23:11:06 CEST 2004


Hi,

is it possible to exclude a region of a data from ones plot while
automatically correcting the axes tick labels (taking into
account the possible use of \readdata[nStep=..] and changing of
`ScalePoints')?

At the moment I'm using \listdata twice to plot the portions on
the left and the right side of the data I wish to include (having
to adjust the right side of the data with \rput).  Then I have to
manually adjust the axes tick labels (\multido) and delete the
part of the axes being excluded.  At the end I have to create an
`exclude' symbol. Time consuming, to say the least.

Is there a more flexible way of doing this?

I've included an example below.

As always appreciating any feedback,

Patrick

--8<------------------------schnipp------------------------->8---
\documentclass{scrartcl} 
\usepackage{pstricks-add}

\begin{document}

% normally done with \readdata and nStep=...:
\def\dataB{%
   0.0000000e+00   0.0000000e+00   0.0000000e+00
   1.0000000e+00   0.0000000e+00   0.0000000e+00
   2.0000000e+00   0.0000000e+00   2.4000000e+04
   3.6000000e+00   0.0000000e+00   2.4000000e+04
   4.5000000e+00   0.0000000e+00   0.0000000e+00
   14.5		   0		   0
   111.55	   0		   0
   1.2400000e+02   0.0000000e+00   0.0000000e+00
   1.2700000e+02  -1.2000000e+04   0.0000000e+00
   1.2750000e+02  -6.0000000e+03   2.4000000e+04
   1.2800000e+02   0.0000000e+00   0.0000000e+00
}

% rescaling data:
\makeatletter
\pst at def{ScalePoints}<%
/y ED /x ED
counttomark dup dup cvi eq not { exch pop } if
/m exch def /n m 2 div cvi def 
n { y mul 1000 div m 1 roll 
  x mul 10 div m 1 roll 
  /m m 2 sub def } repeat>
\makeatother
%
\psset{xunit=2.75cm,yunit=0.5mm}
\begin{pspicture}(-0.55,-15)(4,33)
  % axes:
  \psaxes[labels=y,Dx=1,Dy=10,tickstyle=bottom]{<->}(0,0)(0,-15)(3.3,30)
  \multido{\n=0+1}{2}{\uput[-90](\n,0){\n}}
  \multido{\npos=2+1,\n=11+1}{2}{%
    \uput[-90](\npos,0){\n}}
  % `exclude' symbol:
  \rput{70}(1.45,0){\psline(-0.1,0)(0.1,0)}
  \rput{70}(1.55,0){\psline(-0.1,0)(0.1,0)}
  % data1:
  \listplot[plotstyle=line,linestyle=solid,%
  plotNo=1,plotNoMax=2,xEnd=14.5]{\dataB}
  \rput(-10,0){%
    \listplot[plotstyle=line,%
    plotNo=1,plotNoMax=2,xStart=111.55]{\dataB}}
  % data2:
  \listplot[plotstyle=line,linestyle=solid,linecolor=blue,%
  plotNo=2,plotNoMax=2,xEnd=14.5]{\dataB}
  \rput(-10,0){%
    \listplot[plotstyle=line,linecolor=blue,%
    plotNo=2,plotNoMax=2,xStart=111.55]{\dataB}}
  % "delete" part of line:
  \psline[linecolor=white,linewidth=2pt](1.45,0)(1.55,0) 
\end{pspicture}

\end{document}
--8<------------------------schnapp------------------------->8---

-- 
Als deutscher Tourist im Ausland steht man vor der Frage, ob man sich
anständig benehmen muß oder ob schon deutsche Touristen dagewesen
sind.  (Kurt Tucholsky)




More information about the PSTricks mailing list