[pstricks] Axes and huge numbers
Martin Chicoine
martin.chicoine at umontreal.ca
Tue Apr 7 21:19:55 CEST 2009
De : pstricks-bounces at tug.org [mailto:pstricks-bounces at tug.org] De la part
de Mikel Catania
Envoyé : 7 avril 2009 14:43
À : Graphics with PSTricks
Objet : [pstricks] Axes and huge numbers
> Hi all,
>
> I'm plotting a function with x-values ranging from 0 to 1500000, and
y-values from 0 to 160000.
> The plot has to be around 12cm wide, so I set xunit=.00008mm. The plot
works fine, but only if
> I set "labels=none" in the \psaxes options. The following example shows
that clearly:
>
> \documentclass{article}
>
> \usepackage{pstricks}
> \usepackage{pst-plot}
>
> \begin{document}
>
> \psset{unit=.00008mm,xunit=.00008mm,yunit=.0004mm}
>
> \begin{pspicture}(0,0)(1500000,160000)
> % Axes
> \psaxes[Dx=250000,Dy=50000,labels=none]{->}(0,0)(1500000,160000)
> % Functions
> \psplot[showpoints=true,plotpoints=15]{0}{1500000}{0.08615 x mul 18000
add}
>
\psplot[showpoints=true,dotstyle=square*,plotpoints=15]{0}{1500000}{0.05468
x mul 42000 add}
> % Captions
>
\rput[l](1000000,70000){\psline(0,2000)(100000,2000)\psdot(50000,2000)\qquad
\quad graph one}
>
\rput[l](1000000,50000){\psline(0,2000)(100000,2000)\psdot[dotstyle=square*]
(50000,2000)\qquad\quad graph two}
> \end{pspicture}
>
> \end{document}
>
> Anytime I change the options of \psaxes to "labels=all", I get an error
"Dimension too large". I could \rput all values, but it is tedious and I'd
like to know how to make this work.
>
> Thanks in advance,
>
> Mikel
With pstricks-add you can divide everything by 1000 and use xlabelFactor and
ylabelFactor. The only problem is that you have to use showorigin=false,
otherwise you get "0000" at the origin. Maybe Herbert has a fix for that?
\documentclass{article}
\usepackage{pstricks-add}
\begin{document}
\begin{psgraph}[arrows=->,Dx=250,Dy=50,xlabelFactor={000},ylabelFactor={000}
,
showorigin=false](0,0)(1500,160){11.2cm}{6.4cm}
% Functions
\psplot[showpoints=true,plotpoints=15]{0}{1500}{0.08615 x mul 18 add}
\psplot[showpoints=true,dotstyle=square*,plotpoints=15]{0}{1500}{0.05468 x
mul 42 add}
% Captions
\rput[l](1000,70){\psline(0,2)(100,2)\psdot(50,2)\qquad\quad graph one}
\rput[l](1000,50){\psline(0,2)(100,2)\psdot[dotstyle=square*](50,2)\qquad\qu
ad graph two}
\end{psgraph}
\vspace{1cm}
\psset{unit=.00008mm,xunit=.00008mm,yunit=.0004mm}
\begin{pspicture}(0,0)(1500000,160000)
% Axes
\psaxes[Dx=250000,Dy=50000,labels=none]{->}(0,0)(1500000,160000)
% Functions
\psplot[showpoints=true,plotpoints=15]{0}{1500000}{0.08615 x mul 18000 add}
\psplot[showpoints=true,dotstyle=square*,plotpoints=15]{0}{1500000}{0.05468
x mul 42000 add}
% Captions
\rput[l](1000000,70000){\psline(0,2000)(100000,2000)\psdot(50000,2000)\qquad
\quad graph one}
\rput[l](1000000,50000){\psline(0,2000)(100000,2000)\psdot[dotstyle=square*]
(50000,2000)\qquad\quad graph two}
\end{pspicture}
\end{document}
More information about the PSTricks
mailing list