Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage{pgfplots}
- % argument #1: any options
- newenvironment{customlegend}[1][]{%
- begingroup
- % inits/clears the lists (which might be populated from previous
- % axes):
- csname pgfplots@init@cleared@structuresendcsname
- pgfplotsset{#1}%
- }{%
- % draws the legend:
- csname pgfplots@createlegendendcsname
- endgroup
- }%
- % makes addlegendimage available (typically only available within an
- % axis environment):
- defaddlegendimage{csname pgfplots@addlegendimageendcsname}
- begin{document}
- thispagestyle{empty}
- begin{tikzpicture}
- begin{customlegend}[legend entries={$a$,$e^x$,C,$d$}]
- addlegendimage{red,fill=black!50!red,area legend}
- addlegendimage{red,fill=black!50!red,sharp plot}
- addlegendimage{red,fill=black!50!red,mark=*,sharp plot}
- addlegendimage{red,fill=black!50!red,ybar,ybar legend}
- end{customlegend}
- end{tikzpicture}
- end{document}
- documentclass{article}
- usepackage{pgfplots}
- begin{document}
- begin{tikzpicture}
- begin{axis}[xmin=0,xmax=10,ymin=-5,ymax=5,name=border]
- end{axis}
- node[below left=1mm] at (border.north east) {fbox{
- begin{tabular}{@{}r@{ }l@{}}
- raisebox{2pt}{tikz{draw[black] (0,0) -- (5mm,0);}}&black\
- raisebox{2pt}{tikz{draw[red] (0,0) -- (5mm,0);}}&red\
- raisebox{2pt}{tikz{draw[green] (0,0) -- (5mm,0);}}&green\
- raisebox{2pt}{tikz{draw[blue] (0,0) -- (5mm,0);}}&blue\
- end{tabular}}};
- end{tikzpicture}
- end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement