I am trying to produce a picture showing the mean value theorem for definite integrals. To do this I am using pgfplots with fillbetween. However, when using the standalone class I get a lot of blank space in the produced pdf file that shouldn't be there.
MWE:
\RequirePackage{luatex85}
\documentclass{standalone}
\usepackage{ifluatex}
\ifluatex
\usepackage{fontspec}
\setmainfont{Calibri}
\usepackage{unicode-math}
\setmathfont{Cambria Math}
\else
\usepackage[utf8]{inputenc}
\fi
\usepackage{pgfplots}
\usepgfplotslibrary{fillbetween}
\begin{document}
\begin{tikzpicture}[scale=1.5]
\begin{axis}[axis equal image,%
axis lines=middle,%
axis line style=thick,%
clip=false,%
xmin=0,%
xmax=4,%
ymin=0,%
ymax=2.5,%
every axis x label/.style={
at={(ticklabel* cs:1.025)},
anchor=west,
},%
every axis y label/.style={
at={(ticklabel* cs:1.025)},
anchor=south,
},%
xlabel=$x$,%
ylabel=$y$,%
ticks=none,%
axis line style={->}]
\addplot[thick,samples=200,domain=1:1.7436,name path=fEn]
(x,{(x-2)*cos(3*pi*deg(x)/5) + 1});
\addplot[thick,name path=cEn] coordinates {
(1,1.2537) (1.7436,1.2537)};
\addplot+[thick,fill=green!20] fill between [of=fEn and cEn];
\addplot[thick,samples=200,domain=1.7436:2.6975,name path=fTo]
(x,{(x-2)*cos(3*pi*deg(x)/5) + 1});
\addplot[thick,name path=cTo] coordinates {
(1.7436,1.2537) (2.6975,1.2537)};
\addplot+[thick,fill=red!20] fill between [of=fTo and cTo];
\addplot[thick,samples=200,domain=2.6975:3,name path=fTre]
(x,{(x-2)*cos(3*pi*deg(x)/5) + 1});
\addplot[thick,name path=cTre] coordinates {
(2.6975,1.2537) (3,1.2537)};
\addplot+[thick,fill=green!20] fill between [of=fTre and cTre];
\addplot[thick,samples=200,domain=1:3]
(x,{(x-2)*cos(3*pi*deg(x)/5) + 1}) node[near
start,yshift=0.75cm,xshift=-0.125cm]{$y = f(x)$};
\addplot[thick,densely dashed,domain=0:1.2537] (1.7436,1.2537 - x)
node[below]{$c$};
\addplot[thick] coordinates {
(1,1.2537) (3,1.2537)};
\addplot[thick,densely dashed,domain=0:1.309] (1,1.309 - x)
node[below]{$a$};
\addplot[thick,densely dashed,domain=0:1.809] (3,1.809 - x)
node[below]{$b$};
\end{axis}
\end{tikzpicture}
\end{document}
Any thoughts?
\begin{tikzpicture}[scale=1.5]. Movescale=1.5to\begin{axis}[...]and it works. Oh, and don't ask me why. Thestandaloneclass is actually a little weird. – Henri Menke Sep 10 '17 at 23:12