\documentclass{article}
\usepackge{pgfplots}
\usepackage{tikz}
\begin{document}
\begin{figure}[H]
\centering
\resizebox{0.80\textwidth}{!}{%
\begin{tikzpicture}
\begin{axis}[width=15cm,compat=1.5,height=9.5cm, legend columns=-1,
, axis line style=thick,
legend style={/tikz/every even column/.append style={column sep=6.15cm}, at={(0,0)}, mark
size=2.5pt, anchor=north east, at={(axis description cs:1.0,1.15)}, font=\small},
xlabel=\large periods, tick align=inside,
xtick={35,...,45},
ytick={0,10000,20000,...,1500000},
ylabel=\large Cases,
ymajorgrids=true,
grid style=dashed,
scaled x ticks=false,
]
\addplot[very thick,mark size=2.5pt,color=cyan,mark=x]
plot coordinates {
(37,205945.16)
(38,262273.00)
(39,334005.49)
(40,425355.53)
(41,541688.17)
(42,689835.69)
(43,878498.89)
(44,1118758.08)
(45,1424723.84)
};
\end{axis}
\end{tikzpicture}
}
\end{figure}
\end{document}
答案1
这是ytick
令人反感的部分。通常,pgfplots
处理这些数字没有问题,但是当您使用<first>,<second>,...,<final>
语法时,pgfplots
会使用 TikZ ,foreach
因此基于 TeX 的pgfmath
功能最多限制为 16384。然后它就出错了。您可以拼出刻度或使用minor y tick num
作为更快的修复。如果您愿意,您也可以为它们打开网格。
\documentclass{article}
\usepackge{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
minor y tick num=5,
ymajorgrids=true,
grid style=dashed,
scaled x ticks=false,
]
\addplot[very thick,mark size=2.5pt,color=cyan,mark=x]
coordinates {
(37,205945.16)
(38,262273.00)
(39,334005.49)
(40,425355.53)
(41,541688.17)
(42,689835.69)
(43,878498.89)
(44,1118758.08)
(45,1424723.84)
};
\end{axis}
\end{tikzpicture}
\end{document}