# Horizontally align pgf plots with y-axis

I want to horizontally align my two graphs, so that the y-axes are aligned. The problem is that the one y-axis has double digits and the other has single digits as the units.

\documentclass[12pt]{article}
\usepackage{tikz, color}
\usepackage{pgfplots}

\pgfplotsset{compat=1.12, width=12cm}

\begin{document}

\begin{tikzpicture}
\begin{axis}[axis lines = left, xmin=0, ymin=0]
{0.001*x^3-0.09*x^2+2.95*x}
;
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}
\begin{axis}[axis lines = left, xmin=0, ymin=0]
{0.001*x^2-0.09*x+2.95}
;
{0.003*x^2-0.18*x+2.95}
;
\end{axis}
\end{tikzpicture}

\end{document}

• $\ \,$ does the trick, but I want a proper method. – ahorn Apr 13 '16 at 22:43
• You could also have a look at the groupplots library of pgfplots. – Torbjørn T. Sep 29 '16 at 13:14

One possibility is using option trim axis left for both tikzpicture environments:

\documentclass[12pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12, width=12cm}
\usepackage{showframe}
\begin{document}
\begin{center}
\begin{tikzpicture}[trim axis left]
\begin{axis}[axis lines = left, xmin=0, ymin=0]
{0.001*x^3-0.09*x^2+2.95*x}
;
\end{axis}
\end{tikzpicture}

\begin{tikzpicture}[trim axis left]
\begin{axis}[axis lines = left, xmin=0, ymin=0]