![如何在 pgfplots 的轴上保留四位小数?](https://linux22.com/image/426350/%E5%A6%82%E4%BD%95%E5%9C%A8%20pgfplots%20%E7%9A%84%E8%BD%B4%E4%B8%8A%E4%BF%9D%E7%95%99%E5%9B%9B%E4%BD%8D%E5%B0%8F%E6%95%B0%EF%BC%9F.png)
以下是我得到的信息:
这是我的代码:
\documentclass{book}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\pgfplotstableread{
x y
1.3325 1535.5
1.3335 1537.82
1.3349 1540.92
1.3362 1543.62
1.3375 1546
}{\datatable}
\begin{tikzpicture}
\begin{axis}[
x tick label style={
/pgf/number format/.cd,
precision=5,
/tikz/.cd
}
]
\addplot+[] table [] {\datatable};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
您在寻找吗xtick=data
?
\documentclass{book}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\pgfplotstableread{
x y
1.3325 1535.5
1.3335 1537.82
1.3349 1540.92
1.3362 1543.62
1.3375 1546
}{\datatable}
\begin{tikzpicture}
\begin{axis}[xtick=data,
x tick label style={
/pgf/number format/.cd,
precision=5,
/tikz/.cd
}
]
\addplot+[] table [] {\datatable};
\end{axis}
\end{tikzpicture}
\end{document}