我正在尝试创建一个单独的独立颜色条,并使用我想要加载的文件中的值来标记颜色\pgfplotstableread
。我已经取得了很大进展,但我学到的所有关于数字精度的知识都不起作用。
这是我得到的:
\documentclass{article}
\usepackage{siunitx}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\begin{filecontents}{testdata.txt}
D d K k
0.000000 0 0.400000 1400000.000000
0.400000 805.267394 0.400000 1400000.000000
0.950000 1912.510060 0.400000 1400000.000000
1.720000 3462.649793 0.400000 1400000.000000
2.790000 5616.740071 0.400000 1400000.000000
4.290000 8636.492797 0.400000 1400000.000000
6.390000 12864.146614 0.400000 1400000.000000
9.310000 18742.598588 0.400000 1400000.000000
13.390000 26956.326003 0.400000 1400000.000000
19.090000 38431.386363 0.400000 1400000.000000
NaN NaN NaN NaN
\end{filecontents}
\begin{document}
\centering
\pgfplotstableread[skip first n=1]{testdata.txt}\DkC
\pgfplotscolorbardrawstandalone[
colormap/viridis,
xminorgrids=false,
parent axis width/.initial=15cm,
parent axis height/.initial=1cm,
point meta min=1,
point meta max=11,
colorbar sampled,
colorbar horizontal,
colorbar style={
samples=11,
xlabel=$D$,
yshift=2mm,
xtick={1.5,...,9.5,10.5},
xticklabels from table = {\DkC}{d},
xticklabel style={/pgf/number format/.cd,fixed,precision=0},
}
]
\end{document}
但我希望数字四舍五入precision=0
。我该如何实现呢?