5

I'm having a problem with my axis. I'm not entirely sure axis is the right word, but take a look at the output and you will understandweird axis number placement

Upper right corner, first of all, the multiplier 10^-3 is placed wrongly (in my oppinion) second of all, I really don't want no multiplier, I want the colorbar to show 0.001, 0,0012 etc. It is produced from the matlab script matlab2tikz.m. A MWE is not possible as it requires a .png file created by the matlab script to compile properly (don't think i can attach separate files to my post in this forum), but I can at least display the contents of my .tex file

\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}

I managed to change formating on the axis numbers by passing

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

as axis options, I'm guessing something similar can be done to colorbar, just don't quite know how...

1 Answers1

4

To get rid of the axis multiplier, use the approach described in How do you remove the axis multiplier?:

\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}
Jake
  • 232,450