Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Consider the following example:

\documentclass{article}
\usepackage{pst-plot}

\begin{document}

\savedata{\data}[{1999,6276},{2000,6827},{2001,7783},{2002,9819}]
\psset{xAxisLabel={Year},yAxisLabel={Ocapi}}
\begin{psgraph}[Ox=1999,xlabelOffset=0.5,Dy=2000]{->}(1999,0)(2004,13000){13.5cm}{8.1cm}
\dataplot[plotstyle=dots,dotstyle=o,fillcolor=red]{\data}
\end{psgraph}

\end{document}

I tried to re-use this answer from Herbert but it is not working. The error is

! Dimension too large.
<recently read> \pst@xunit 

l.8 ...000]{->}(1999,0)(2004,13000){13.5cm}{8.1cm}

If I can get a solution and an explanation as to why it is not working, I would be greatful.

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

Run with any compiler:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
    axis lines=left, enlarge x limits=true,
    /pgf/number format/1000 sep={},
    xtick={1999,...,2002},
    ymin=0
]
\addplot +[only marks] table{
1999 6276
2000 6827
2001 7783
2002 9819
};
\end{axis}
\end{tikzpicture}

\end{document}

(with a wink and nod to Herbert)


With pst-plot, you need to shift your coordinates manually before you can plot them. You do this by adding

\pstScalePoints(1,1){1999 sub}{}

which subtracts 1999 from all your x coordinates. If you then adjust your plot limits to range from x=0 to 5 and use \listplot instead of \dataplot, you get the following:

\documentclass{article}
\usepackage{pst-plot}

\begin{document}

\savedata{\data}[{1999,6276},{2000,6827},{2001,7783},{2002,9819}]
\pstScalePoints(1,1){1999 sub}{}
\psset{xAxisLabel={Year},yAxisLabel={Ocapi}}
\begin{psgraph}[Ox=1999,xlabelOffset=0.5,Dy=2000]{->}(0,0)(5,13000){13.5cm}{8.1cm}
\listplot[plotstyle=dots,dotstyle=o,fillcolor=red]{\data}
\end{psgraph}

\end{document}
share|improve this answer
1  
Thank you, Jake. I will be glad if the plot can be made with pst-plot but if I don't get an PSTricks answer, I will accept your answer. –  Svend Tveskæg Feb 8 '13 at 16:52
    
@SvendMortensen: I figured out the PSTricks issue: pst-plot doesn't internally rescale the data like PGFPlots does, which is why you get the dimension too large errors. You need to manually shift your data first. I've edited my answer. –  Jake Feb 8 '13 at 17:19
    
Great. Thank you, Jake. –  Svend Tveskæg Feb 8 '13 at 17:33
add comment
\documentclass{article}
\usepackage{pst-plot}

\begin{document}

\savedata{\data}[{1999,6276},{2000,6827},{2001,7783},{2002,9819}]
\psset{xAxisLabel=Year,yAxisLabel=Ocapi}
\begin{psgraph}[Ox=1999,xlabelOffset=0.5,Dy=2000]{->}(0,0)(5,13000){10cm}{6cm}
\pstScalePoints(1,1){ 1999 sub }{}
\listplot[showpoints,linecolor=red,linewidth=1pt]{\data}
\end{psgraph}

\end{document}
share|improve this answer
    
What is the difference between this answer and Jake's? Am I missing something obvious? –  Svend Tveskæg Feb 8 '13 at 19:28
2  
using showpoints instead of setting dots and a line –  Herbert Feb 8 '13 at 19:42
    
I see. Thank you. –  Svend Tveskæg Feb 8 '13 at 19:49
1  
@SvendMortensen: I don't see. Where did I set a line in the PSTricks approach? –  Jake Feb 9 '13 at 0:30
    
@Jake. I looked at the pst-plot code instead of the pgfplots code. Sorry. (Maybe Herbert did the same thing.) –  Svend Tveskæg Feb 9 '13 at 2:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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