TeX - LaTeX Asked on April 25, 2021
In this example (from here),
documentclass[border=2mm,tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}[
y tick label style={/pgf/number format/.cd,%
scaled y ticks = false,
set thousands separator={},
fixed},
x tick label style={/pgf/number format/.cd,%
scaled x ticks = false,
fixed}%
]
addplot coordinates {
(0.1,1000)
(0.2,1100)
(0.3,1200)
};
end{axis}
end{tikzpicture}
end{document}
the x-axis ticks are printed with just one number after the decimal point, when it’s possible:
0.1
0.15
0.2
0.25
0.3
I would like instead to put zero-padding, to always have the same number of digits (2, in this example) after the point:
0.10
0.15
0.20
0.25
0.30
Is it possible? If yes, how?
fixed zerofill
and precision
may be the keys you are looking for.
documentclass[border=2mm,tikz]{standalone}
usepackage{pgfplots}
begin{document}
begin{tikzpicture}
begin{axis}[
y tick label style={/pgf/number format/.cd,%
scaled y ticks = false,
set thousands separator={},
fixed},
x tick label style={/pgf/number format/.cd,%
scaled x ticks = false,
fixed zerofill,precision=2}%
]
addplot coordinates {
(0.1,1000)
(0.2,1100)
(0.3,1200)
};
end{axis}
end{tikzpicture}
end{document}
Correct answer by user230294 on April 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP