I have the following MWE:
\documentclass{standalone}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\usepackage{filecontents}
\pgfplotsset{compat=1.12}
\begin{filecontents}{data.dat}
4 -1e4
4 -1e3
4 -1e2
4 -10
4 -1
\end{filecontents}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=5
]
\addplot table {data.dat};
\end{axis}
\end{tikzpicture}
\end{document}
This produces the following plot:
Now I'd like to have ticks on the y axis at -1e0, -1e1, -1e2, -1e3 and -1e4 with even spacing. If my values are positive, I can achieve this by adding ymode=log
to the axis options, but for negative values this just produces an error.
So how can I produce a sort of logarithmic scale for negative values?
Best Answer
This works, but requires copious manual intervention. Note, in this case [ytick=data] would achieve the same effect, but in general you can't count on that.