pgfplots 中奇怪的轴号位置

pgfplots 中奇怪的轴号位置

我的轴出了问题。我不太确定 axis 这个词是否正确,但看看输出你就会明白奇怪的轴号位置

右上角,首先,乘数 10^-3 放错了位置(在我看来)其次,我真的不想要乘数,我希望颜色条显示 0.001、0,0012 等。它由 matlab 脚本 matlab2tikz.m 生成。MWE 是不可能的,因为它需要由 matlab 脚本创建的 .png 文件才能正确编译(我不认为我可以在此论坛的帖子中附加单独的文件),但我至少可以显示我的 .tex 文件的内容

\documentclass[tikz]{standalone}
\usetikzlibrary{calc}
\usetikzlibrary{arrows}
\usetikzlibrary{automata,positioning}
\usepackage{verbatim}
\usetikzlibrary{decorations}
\usetikzlibrary{patterns}
\usetikzlibrary{shapes,fit,chains}
\usetikzlibrary{matrix}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pgfplotsset{plot coordinates/math parser=false}
\pgfplotsset{every axis/.append style={line width=2pt,font=\huge}, every  mark/.append style={solid}}
\pgfplotsset{every axis plot post/.append style={mark=none}}

\usepackage{amssymb,amsmath,amstext,mathtools,siunitx}

\begin{document}

\begin{tikzpicture}

\begin{axis}[%
view={0}{90},
width=3.79861111111111in,
height=3.565625in,
scale only axis,
xmin=0.5, xmax=181.5,
xlabel={N},
% y dir=reverse,
ymin=0.5, ymax=181.5,
ylabel={M},
name=plot1,
colormap/jet,
colorbar,
point meta min=4.5595812681043e-08,
point meta max=0.00152621508007855]
\addplot graphics [xmin=5.000000e-01, xmax=1.815000e+02, ymin=5.000000e-01, ymax=1.815000e+02] {spongeLayerDequalsTen-1.png};
\end{axis}
\end{tikzpicture}%

\end{document}

我设法通过传递来改变轴数字的格式

/pgf/number format/.cd,
fixed,
fixed zerofill,precision=2,

作为轴选项,我猜测可以对颜色条做类似的事情,只是不太清楚如何做......

答案1

要摆脱轴乘数,请使用如何删除轴乘数?

\pgfplotsset{
    every colorbar/.append style={
        scaled y ticks = false,
        /pgf/number format/fixed,
        /pgf/number format/fixed zerofill,
        /pgf/number format/precision=4
    }
}

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pgfplotsset{
    every axis/.append style={line width=2pt,font=\huge}}
\pgfplotsset{every axis plot post/.append style={mark=none}}
\pgfplotsset{
    every colorbar/.append style={
        scaled y ticks = false,
        /pgf/number format/fixed,
        /pgf/number format/fixed zerofill,
        /pgf/number format/precision=4
    }
}

\begin{document}

\begin{tikzpicture}

\begin{axis}[%
view={0}{90},
width=3.79861111111111in,
height=3.565625in,
scale only axis,
xmin=0.5, xmax=181.5,
xlabel={N},
ymin=0.5, ymax=181.5,
ylabel={M},
name=plot1,
colormap/jet,
colorbar,
point meta min=4.5595812681043e-08,
point meta max=0.00152621508007855]
\addplot graphics [xmin=5.000000e-01, xmax=1.815000e+02, ymin=5.000000e-01, ymax=1.815000e+02] {image};
\end{axis}
\end{tikzpicture}%

\end{document}

相关内容