调整 pgfplots 3D 轴中的轴标签乘数距离

调整 pgfplots 3D 轴中的轴标签乘数距离

我无法在以下 3D 图的 MWE 中获得可接受位置的刻度标签乘数:

% !TeX program = lualatex
\RequirePackage{luatex85}
\documentclass[border=1pt]{standalone}

\usepackage{fontspec}


\usepackage{mathtools}
\usepackage{siunitx}

\usepackage{xcolor}

\usepackage{tikz}
\usetikzlibrary{
    pgfplots.groupplots,
    babel
}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usepackage{pgfplotstable}

\usepackage[main=ngerman,english]{babel}

\begin{document}

\centering
\begin{tikzpicture}
    \begin{axis}[
        grid=both,
        clip=false,
        view={120}{45},
        xmin=0,
        xmax=0.01,
        ymode=log,
        ytick={0.01,0.1,1,10},
        ymin=0,
        ymax=100,
        zlabel={C},
    ]
    \addplot3 [surf,samples=4,domain=0:0.01, y domain=1:100] {x+y};
    \node at (rel axis cs:0.5,0,1) [above,sloped like x axis] {A};
    \node at (rel axis cs:0,0.5,1) [above,sloped like y axis] {B};
    \end{axis}
\end{tikzpicture}

\end{document}

观察刻度标签乘数10^-2与轴的距离有多远;

在此处输入图片描述

我希望它更靠近轴的另一端,甚至更好。

答案1

如果您想更改刻度标签的位置,请every x tick scale label/.style根据需要更改条目。这里有一个可能适合您需要的示例。

% used PGFPlots v1.15
\documentclass[border=5pt]{standalone}
\usepackage{pgfplots}
    \pgfplotsset{
        compat=1.15,
    }
\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        grid=both,
        clip=false,
        view={120}{45},
        xmin=0,
        xmax=0.01,
        ymode=log,
        ytick={0.01,0.1,1,10},
        ymin=0,
        ymax=100,
        zlabel={C},
        % ---------------------------------------------------------------------
        % added
        every x tick scale label/.style={
            at={(xticklabel* cs:-0.2)},
            anchor=near xticklabel,
            inner sep=0pt,
        },
        % ---------------------------------------------------------------------
    ]
        \addplot3 [surf,samples=4,domain=0:0.01, y domain=1:100] {x+y};

        \node at (rel axis cs:0.5,0,1) [above,sloped like x axis] {A};
        \node at (rel axis cs:0,0.5,1) [above,sloped like y axis] {B};
    \end{axis}
\end{tikzpicture}
\end{document}

该图显示了上述代码的结果

相关内容