pgfplot 给我“无法解析输入”作为浮点数,抱歉。”

pgfplot 给我“无法解析输入”作为浮点数,抱歉。”

我正在尝试创建一个图,虽然我对 LaTeX 还很陌生,但我感觉我已经对它有了很好的感觉。但是,我似乎无法修复此错误:

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

我已经尝试了 2 个小时,但找不到任何解决方案。有人可以指导我吗?

这是我的代码:

\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}

答案1

pgfplots期望列表中有另一个数字。更改ytick={0.0,2.5,5.0,7.5,10.0,}ytick={0.0,2.5,5.0,7.5,10.0}(删除 前的逗号})。

相关内容