-
-
Save TorbjornT/582ba77168ee6c31011fc6c9a6a5b9c6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{standalone} | |
\usepackage{pgfplots} | |
\pgfplotsset{compat=newest} | |
\usepackage{mathtools} | |
\newcommand{\LHS}[2][1.5em]{\hspace{#1}\mathllap{#2}} | |
\newcommand{\RHS}[2][1.5em]{\mathrlap{#2}\hspace{#1}} % moved \hspace after mathrlap | |
\begin{document} | |
\begin{tikzpicture} | |
\begin{axis}[ | |
legend cell align=left, | |
legend style={legend pos=north west} | |
] | |
% added colours to plots | |
\addplot[blue,domain=0:2] {x^2}; | |
\addplot[red,domain=0:4] {x}; | |
\addplot[red,domain=0:4] {x}; | |
\legend{% | |
$\LHS{yy}=\RHS[2em]{x^2}$ text, | |
$\LHS{zty}=\RHS[2em]{xxxx}$ text, | |
$\LHS{y}=\RHS[2em]{x}$ text, | |
} | |
\end{axis} | |
\end{tikzpicture} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment