Gernot already explained the "problem" of your attempt in all detail in his answer, so I will not repeat it here.
Instead I present two possible solutions that result in a bit more "good looking" results (I hope), using Gernot's code as a basis. For more details on how it works, please have a look at the comments in the code.
% used PGFPlots v1.14
\documentclass{article}
\usepackage{showframe}
\usepackage{pgfplots}
% load necessary libraries
\usetikzlibrary{
calc,
pgfplots.groupplots,
}
\pgfplotsset{
% use this `compat' level or higher to use the advanced positioning of
% the axis labels
compat=1.3,
}
% define a cycle list that can then be used later on
\pgfplotscreateplotcyclelist{my cycle list}{
red,\\
magenta,\\
cyan,\\
blue,\\
gray,\\
darkgray\\
}
\begin{document}
% here I present a solution that still has the legend on the right side of the plot
\begin{figure}[!hbt]
\centering
\begin{tikzpicture}
% because both axis environments have the same style this can be realized
% much easier using the `groupplot' environment
\begin{groupplot}[
group style={
% the size of the `groupplot' shall be 2 columns and 1 row ...
group size=2 by 1,
% ... with a reduced horizontal separation ...
horizontal sep=5mm,
% ... and the y ticklabels and y axis labels should only be
% showng on the left-most plot
y descriptions at=edge left,
},
% -----------------------------------------------------------------
% list here all options that are common for both plots
% -----------------------------------------------------------------
% adapt the `width' so the whole `groupplot' still fits into `\textwidth'
width=0.45\textwidth,
% (I recommend using this style to show units)
xlabel={$t$ / s},
ymin=-25,ymax=25,
xmin=0,xmax=6,
minor y tick num=1,
samples=3,
% use the above defined cycle list here
cycle list name=my cycle list,
% also these two options are the same for all `\addplot' commands,
% so we can state it here
/tikz/smooth,
/tikz/mark size=0.8,
]
% this commands starts the first plot
% to which we give the options, that should be appended only to this one
\nextgroupplot[
title={A Sinusoidal Sequence},
]
% because we have used the defined cycle list, this simplifies a lot ...
\addplot {x};
\addplot {2*x};
\addplot {3*x};
% ... only here one thing is special, so we append this option by
% using `\addplot+'
% (of course we could also have included this option in the
% definition of the cycle list itself)
\addplot+ [mark=*] {-x};
\addplot {-2*x};
\addplot {-3*x};
% this starts the second plot
\nextgroupplot[
title={Corresponding Limb Lengths},
% the legend should only be shown for this plot, because it is
% identical to both plots
% (also here I prefer showing the units in this style, like for
% the `xlabel'.
% (Strictly speaking it isn't allowed to divide by the unit "degree",
% but I think this is the lesser evil compared to your solution))
legend entries={
$\Delta{x}$ / mm,
$\Delta{y}$ / mm,
$\Delta{z}$ / mm,
$\Delta{\psi}$ / °,
$\Delta{\theta}$ / °,
$\Delta{\phi}$ / °,
},
legend pos=outer north east,
% because this looks better for these legend entries, use another
% alignment for them
legend cell align=left,
]
\addplot {x^2};
\addplot {2*x^2};
\addplot {3*x^2};
\addplot+ [mark=*] {-x^2};
\addplot {-2*x^2};
\addplot {-3*x^2};
\end{groupplot}
\end{tikzpicture}
\caption{A sequence of sinusoidal Cartesian trajectories (left),
and their corresponding limb lengths with white noise (right)}
\label{fig1}
\end{figure}
% to enlarge the plots even more, here I present a solution that still shows
% the legend centered below both plots
\begin{figure}[!hbt]
\centering
\begin{tikzpicture}
\begin{groupplot}[
group style={
group size=2 by 1,
horizontal sep=5mm,
y descriptions at=edge left,
},
scale only axis,
width=0.43\textwidth, % <-- as you can see, the value was increased
xlabel={$t$ / s},
ymin=-25,ymax=25,
xmin=0,xmax=6,
minor y tick num=1,
cycle list name=my cycle list,
samples=3,
/tikz/smooth,
/tikz/mark size=0.8,
]
\nextgroupplot[
title={A Sinusoidal Sequence},
]
\addplot {x};
\addplot {2*x};
\addplot {3*x};
\addplot+ [mark=*] {-x};
\addplot {-2*x};
\addplot {-3*x};
\nextgroupplot[
title={Corresponding Limb Lengths},
legend entries={
$\Delta{x}$ / mm,
$\Delta{y}$ / mm,
$\Delta{z}$ / mm,
$\Delta{\psi}$ / °,
$\Delta{\theta}$ / °,
$\Delta{\phi}$ / °,
},
legend cell align=left,
% -----------------------------------------------------------------
% (adapted from <https://tex.stackexchange.com/a/80223/95441>)
% -----
% reorganize the legend so it shows up the entries in 3 columns
legend columns=3,
% because then the space between the text and the next symbol/line
% is very small, I enlarge it a bit
legend style={
% (the /tikz/ prefix is necessary here...
% otherwise, it might end-up with `/pgfplots/every even column`
% which is not what we want. compare pgfmanual.pdf)
% -----
% it is only every "even" column, because essentially the legend
% isn't drawn in 3 columns as stated above, but in 2*3 columns.
% In every odd column the symbol/line is drawn and in every
% even column the corresponding text/label
/tikz/every even column/.style={
column sep=10pt,
},
},
% and the legend should be stored in a label with the given name.
% That allows to reference it whereever we want.
legend to name={plot:legend},
% -----------------------------------------------------------------
]
\addplot {x^2};
\addplot {2*x^2};
\addplot {3*x^2};
\addplot+ [mark=*] {-x^2};
\addplot {-2*x^2};
\addplot {-3*x^2};
\end{groupplot}
% Because we want to center it below the plots, we first finished them
% and now we place a node below it at the given coordinate and as text
% we simply need to reference the labeled/stored legend
\node [
% use this anchor for the node
anchor=north,
% this calculates the middle between the both plots without taking the
% ticklabels into account from the left plot
% (the `groupplot' environment names the environment by default with the
% name `group' and each plot gets an appended name.)
] at ($(group c1r1.outer south west)!0.5!(group c2r1.outer south east)$)
{\ref{plot:legend}};
\end{tikzpicture}
\caption{A sequence of sinusoidal Cartesian trajectories (left),
and their corresponding limb lengths with white noise (right)}
\label{fig2}
\end{figure}
\end{document}

\begin{documentclass}... and end with\endocument}. See: https://tex.meta.stackexchange.com/questions/228/ive-just-been-asked-to-write-a-minimal-example-what-is-that. Also a good start tour you can find here: http://tex.stackexchange.com/tour. Then we can help you better and faster... To your question its possible a duplicate to this http://tex.stackexchange.com/q/213075/124842 – Bobyandbob Mar 20 '17 at 07:48