我怎样才能以对数形式表示 x 轴和 y 轴,但仅在 x 轴上使用“正常”数字格式?
我尝试了一些东西,如工作示例中所示:
\documentclass{scrartcl}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmode=log,
% still in logarithmic:
xtick={1, 25, 50, 100},
% obtuse and produces rounding errors in real examples, e.g, 63.99:
% xticklabel={\pgfmathfloatparsenumber{\tick}\pgfmathfloatexp{\pgfmathresult}\pgfmathprintnumber{\pgfmathresult}},
% changes both axes:
% x tick label style={log ticks with fixed point},
ymode=log,
domain=1:100
]
\addplot+ {ln(x)};
\end{axis}
\end{tikzpicture}
\end{document}
谢谢!
答案1
像这样吗?
\documentclass{scrartcl}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmode=log,
% still in logarithmic:
xtick={1, 25, 50, 100},
% obtuse and produces rounding errors in real examples, e.g, 63.99:
% xticklabel={\pgfmathfloatparsenumber{\tick}\pgfmathfloatexp{\pgfmathresult}\pgfmathprintnumber{\pgfmathresult}},
% changes both axes:
% x tick label style={log ticks with fixed point},
ymode=log,
xticklabel={\pgfmathparse{exp(\tick)}\pgfmathprintnumber{\pgfmathresult}},
domain=1:100
]
\addplot+ {ln(x)};
\end{axis}
\end{tikzpicture}
\end{document}