[Tex/LaTex] PSTricks and large numbers in graphics

plotpstricks

I am trying to use PsTricks to plot large numbers. In Herbert Voss's PSTricks: Graphics and PostScript for TeX and LaTeX book (German edition, 2007, 4th edition), there is the code:

\usepackage{pstricks-add}
\readdata{\data}{data.dat} \psset{xunit=0.11mm,yunit=0.00015mm}
\begin{pspicture}(-80,-30000) (1000,310000)
\psaxes[axesstyle=frame,Dx=100,dx=100,Dy=50000,dy=50000](1000,300000)
\listplot [linewidth=1pt,linecolor=black!30] {\data} %aIle
\listplot [nStep=50,linewidth=2pt,plotstyle=dots] {\data}% jeder 50.
\end{pspicture} 

Using the above, I have made a similar code:

\documentclass[12pt]{article}
\usepackage{pst-plot,pstricks-add}

\begin{document} 
\readdata{\data}{data.dat} \psset{xunit=0.11mm,yunit=0.00015mm}
\begin{pspicture}(-80,-30000) (1000,310000)
\psaxes[axesstyle=frame,Dx=100,dx=100,Dy=50000,dy=50000](1000,300000)
\listplot [linewidth=1pt,linecolor=red] {\data}
\end{pspicture}
\end{document}

with the contents of data.dat as

 0   0  
100 10000  
200 15000  
300 20000
400 50000
500 80000
600 100000
700 150000
800 160000

On compiling I get the error message:

! Dimension too large.
<to be read again> 
               =
l.8 \listplot
          [linewidth=1pt,linecolor=red] {\data}
? 

900 200000

What am I doing wrong?

Thanks a lot…


Update

The end of log file with Herbert's second code is:

(c:/texlive/2011/texmf-dist/tex/generic/multido/multido.tex
v1.42, 2010/05/14 <tvz>))
(c:/texlive/2011/texmf-dist/tex/generic/pst-plot/pst-plot.tex
 v1.34, 2011/11/07 (tvz,hv)))
No file withpstri6.aux.
)
*

Best Answer

the labels are set on TeX side and it is difficult to handle such large numbers. Use it this way:

\documentclass[12pt]{article}
\usepackage{filecontents}
\begin{filecontents*}{data.dat}
  0   0  
100 10000  
200 15000  
300 20000
400 50000
500 80000
600 100000
700 150000
800 160000
\end{filecontents*}

\usepackage{pst-plot}

\begin{document} 
\readdata{\data}{data.dat} 

\psset{xunit=0.11mm,yunit=0.15mm,
  ylabelFactor=$\times10^3$,labelFontSize=\footnotesize,mathLabel=false}
\pstScalePoints(1,1){}{1.e3 div}
\begin{pspicture}(-80,-30) (1000,310)
\psaxes[axesstyle=frame,Dx=100,dx=100,Dy=50,dy=50,ticksize=0 4pt](1000,300)
\listplot [linewidth=1.5pt,linecolor=red] {\data}
\end{pspicture}
\end{document}

enter image description here

and the same with a local unit change for y (without using \pstScalePoints:

\documentclass[12pt]{article}
\usepackage{filecontents}
\begin{filecontents*}{data.dat}
  0   0  
100 10000  
200 15000  
300 20000
400 50000
500 80000
600 100000
700 150000
800 160000
\end{filecontents*}

\usepackage{pst-plot}

\begin{document} 
\readdata{\data}{data.dat} 

\psset{xunit=0.11mm,yunit=0.15mm,
  ylabelFactor=$\times10^3$,labelFontSize=\footnotesize,mathLabel=false}
\begin{pspicture}(-80,-30) (1000,310)
\psaxes[axesstyle=frame,Dx=100,dx=100,Dy=50,dy=50,ticksize=0 4pt](1000,300)
\listplot [yunit=0.001,plotstyle=values,rot=90] {\data}
\listplot [yunit=0.001,linewidth=1.5pt,linecolor=red] {\data}
\end{pspicture}
\end{document}

enter image description here

Related Question