I want two axis environments next to each other in one figure environment. I want them to be vertically aligned and scaled to the width of the text. I am trying to achieve this by means of the tikzscale
package and \matrix
group plot capability of pgfplots
, but I get an error.
Compiling
\documentclass{article}
\usepackage{pgfplots}
\usepackage{tikzscale}
\begin{document}
\includegraphics{tikzpicture.tikz}
\end{document}
where tikzpicture.tikz
has the content
\begin{tikzpicture} % THIS EXAMPLE STEMS FROM PAGE 288 FROM THE PGFPLOTS MANUAL REVISION 1.8 (2013/03/17).
\matrix
{
\begin{axis}
\addplot {x};
\end{axis}
&
% differently large labels are aligned automatically:
\begin{axis}
[
ylabel={$f(x)=x^2$},
ylabel style={font=\Huge}
]
\addplot {x^2};
\end{axis}
\\
%
\begin{axis}
[
xlabel=$x$,
xlabel style={font=\Huge}
]
\addplot {x^3};
\end{axis}
&
\begin{axis}
\addplot {x^4};
\end{axis}
\\
};
\end{tikzpicture}
works just fine. But when I then try to scale the (too wide) picture with the tikzscale
package by changing
\includegraphics{tikzpicture.tikz}
to
\includegraphics[witdh=\textwidth]{tikzpicture.tikz}
I get the error
./tikzpicture.tikz:6: Package pgfplots Error: Error: Plot width `-100.58875pt' is too small. This cannot be implemented while maintaining constant size for labels. Sorry, label sizes are only approximate. You will need to adjust your width..
How do I fix this?
\usepgfplotslibrary{groupplots}
from pgfplots-package? ;)