4

I am trying to create a plot, and while I am very new to LaTeX, I feel like I've gotten a good feel for it. However, I cannot seem to fix this error:

Package PGF Math Error: Could not parse input " as a floating point number, sorry. The unreadable part was near ".. 

I have tried for 2 hours now, to find any solutions to no avail. Can anyone guide me?

Here is my code:

\begin{center}
\begin{tikzpicture}
\begin{axis}[width=13cm,height=6cm,
    title={something},
    ylabel={rente i \%},
    xmin=1988, xmax=2019,
    ymin=-2.0, ymax=12.0,
    xtick={1989,1992,1995,1998,2001,2004,2007,2010,2013,2017},
    ytick={0.0,2.5,5.0,7.5,10.0,},
    xticklabel style={/pgf/number format/1000 sep=,rotate=60,anchor=east,font=\normalsize},
    legend pos=north east,
    ymajorgrids=true,
    grid style=dashed,
]

\addplot[
    color=black,
    mark=pentagon*,
    ]
  coordinates {
(1989,9.9)
(1990,9.7)
(1991,10.6)
(1992,9.3)
(1993,9.0)
(1994,7.3)
(1995,7.9)
(1996,8.3)
(1997,6.3)
(1998,5.0)
(1999,4.9)
(2000,5.7)
(2001,5.1)
(2002,5.1)
(2003,4.3)
(2004,4.3)
(2005,3.4)
(2006,3.8)
(2007,4.3)
(2008,4.2)
(2009,3.6)
(2010,2.9)
(2011,2.7)
(2012,1.4)
(2013,1.7)
(2014,1.9)
(2015,0.5)
(2016,0.3)
(2017,0.4)

};
    \legend{10-årig statsobligation}    

\end{axis}
\end{tikzpicture} \\
\end{center}
  • LaTeX errors are not alway easy to guess the meaning of -but you can always uncomment lines until you have a bare minimum that works -and from there slowly find the line and exact thing that is causing the problem. – hpekristiansen Mar 14 '17 at 16:39
4

pgfplots is expecting another number in a list. Change ytick={0.0,2.5,5.0,7.5,10.0,} to ytick={0.0,2.5,5.0,7.5,10.0} (remove the comma before the }).

  • Wow, thank you SO much!! I'll definitely keep this in mind in the future. You are a god send, haha. Have a nice day Erik! – Philip Mar 14 '17 at 16:36

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.