How should this code be updated so that it does not require the compat=1.9 key?
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\begin{document}
\begin{tikzpicture}[baseline]
\begin{axis}[
axis lines=left,
xtick=\empty,
ytick=\empty,
tiny,
ylabel=Edible Resources,
xlabel=Nutritional Need,
title=Distribution of Edibles,
title style={font=\tiny},
]
\addplot[ domain=0:10, color=blue ] {2*x};
\end{axis}
\end{tikzpicture}%
\end{document}
If I remove the compat key, the axis labels are much too far from the axes.
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}[baseline]
\begin{axis}[
axis lines=left,
xtick=\empty,
ytick=\empty,
tiny,
ylabel=Edible Resources,
xlabel=Nutritional Need,
title=Distribution of Edibles,
title style={font=\tiny},
]
\addplot[ domain=0:10, color=blue ] {2*x};
\end{axis}
\end{tikzpicture}%
\end{document}
I tried searching the pgfplots manual for 'likely-seeming' keywords and, also, for things such as \empty, but I could not find anything and ended up giving up.
Part of my motivation for asking this is that I'm generally unclear what the status of compat keys is for pgfplots. In most cases, I assume that compat keys are temporary quick-fixes to get existing code to work. However, I'm not certain whether that is correct for pgfplots or whether I should not even be asking this question.
That is, unlike other packages, maintaining backwards compatibility in pgfplots's case seems to consist of providing compat keys. So is there simply no expectation that the same code will produce the same result? Is it really best practice to always specify a compat key when using pgfplots and not then to change it? If so, how should cases be handled where I want to use plots from different documents in a new document, where the previous documents use different values for compat? Can I simply keep switching mid-document? Is that wise?



compatkey, this activates new features instead of old ones. This is explained in detail in section 2.2 in the PGFPlots manual. There it is also explained, that you can switch thecompatlevel wherever you want inside the document and other stuff. – Stefan Pinnow 9 hours agocompatkey at all. Yet it produced the plots I now needcompat=1.9to create. But if I've understood you correctly, compiling withoutcompatnow should have given me identical results to those I got compiling withoutcompatthree years ago. So I'm really confused. I assumed that something new explained why I needed thecompat=1.9to reproduce the same results as three years ago. Now I have no idea. – cfr 9 hours agocompat=1.3to make the plot look like your "old" version and that is exactly what I have in mind and can be read in section 2.2.1 in the manual. Are you (absolutely) sure that you didn't have acompatlevel active in your old document? Or do you remember which version of PGFPlots you used at that time? – Stefan Pinnow 9 hours agoolddocument. It is actually the same document. I'd just made some changes. But I didn't touch the plot code or anything like that. I certainly did not delete acompatkey. I discovered I needed it when I got weird results. So I assumed that was because something new had made things go haywire. I used1.9because that's what I found I used in another document written around the same time, so I thought that would bebackenough. I have no idea which version ofpgfplotsI had, though. Whatever was in TL 2013, I expect. (Just maybe TL 2014.) – cfr 8 hours agocompatkeys are usually for backwards compatibility, aren't they? And, to be honest, if I'd thought about it, I would have thought that must be the case here given my results .... – cfr 8 hours ago