- I want a standalone diagram (
standalone document class plus pgfplots package).
- I want that the diagram doesn't dance around when I have multiple diagrams with different axis limits and so on.
- Therefore I use
scale only axis and trim the bounding box to the axis (see MWE).
- All works fine but the
border option of the standalone package seems not to work.
border = {15mm 0mm 0mm 0mm} % left bottom right top should add a border to the left side but it adds a border to all four sides.
- The yellow background is only to make the example clearer.
% https://tex.stackexchange.com/questions/123880/
\documentclass[
tikz,
border = {15mm 0mm 0mm 0mm} % left bottom right top
]
{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel = $x$,
ylabel = {$y$},
xmin = 0,
xmax = 30,
ymin = 0,
ymax = 100,
xtick = {0,10,...,30},
ytick = {0,10,...,100},
scale only axis,
% https://tex.stackexchange.com/questions/153708/
execute at end picture={
\pgfresetboundingbox
\path (current axis.north west) (current axis.south east);
},
% https://tex.stackexchange.com/questions/239294
axis background/.style={fill=yellow}
]
%
\addplot[]{x^2};
%
\end{axis}
\end{tikzpicture}
\end{document}
border = {0mm 0mm 0mm 0mm}

border = {15mm 0mm 0mm 0mm}

zap@spaceremoves too much spaces in the failing case. There is no need to setup the border already when loading the class, and imho it would be better if there were a\standalonesetup{...}command. – Ulrike Fischer Jun 15 '17 at 16:19\standaloneconfigsince I did not find\standalonesetupin the manual. – Dr. Manuel Kuehner Jun 15 '17 at 16:31