我有以下半对数图 (y-axis(),其刻度为 10 的非整数幂,如图所示。
我已经提到了这两个答案[1,2]。但是,在这种情况下,两者都无法获得真正的十进制表示(0.16、0.20、0.25),而是显示(10^−0.8、10^−0.7、10^−0.6)。 [1,2]适用于其他值,如 MWE 中的第二个图所示。
如何删除小于 1 的值的 10^(−n) 符号?
平均能量损失
\documentclass{minimal}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
scaled y ticks = false,
y tick label style={/pgf/number format/fixed,
/pgf/number format/1000 sep = \thinspace % Optional if you want to replace comma as the 1000 separator
}]
\addplot coordinates {
(100,0.200001)
(200,0.200003)
(300,0.200005)
};
\end{semilogyaxis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{semilogyaxis}[
scaled y ticks = false,
y tick label style={/pgf/number format/fixed,
/pgf/number format/1000 sep = \thinspace % Optional if you want to replace comma as the 1000 separator
}]
\addplot coordinates {
(100,0.0200001)
(200,10.200003)
(300,110.200005)
};
\end{semilogyaxis}
\end{tikzpicture}
\end{document}
答案1
像这样:
\documentclass{minimal}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{semilogyaxis}[
scaled y ticks = false,
log ticks with fixed point, % <---- added (replace your "y tick label style"
]
\addplot coordinates {
(100,0.200001)
(200,0.200003)
(300,0.200005)
};
\end{semilogyaxis}
\end{tikzpicture}
\begin{tikzpicture}
\begin{semilogyaxis}[
scaled y ticks = false,
log ticks with fixed point, % <---- added (replace your "y tick label style"
]
\addplot coordinates {
(100,0.0200001)
(200,10.200003)
(300,110.200005)
};
\end{semilogyaxis}
\end{tikzpicture}
\end{document}