Graphics, Figures & Tablespgfplots | Move Legend outside Plot Area

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
baxy77bax
Posts: 2
Joined: Mon Mar 05, 2012 1:14 pm

pgfplots | Move Legend outside Plot Area

Post by baxy77bax »

I realized that even if I install and try to compile with pgfplots 1.5.1 on my 2011 latex (Ubuntu 11.10) it still cannot move legend with a following pgf key: Update: this does not work

Code: Select all

 
\documentclass{article}

\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
\begin{axis}[
        legend pos=outer,
        xlabel=$x$,
        ylabel=$y$]
    \addplot[smooth,mark=*,blue] plot coordinates {
        (0,2)
        (2,3)
        (3,1)
    };
\end{axis}
\end{tikzpicture}
\end{document}

Error: ! Package pgfkeys Error: I do not know the key '/tikz/legend pos' and I am going to ignore it. Perhaps you misspelled it


This does!(with every version)

Code: Select all

 
\documentclass{article}

\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}

\begin{tikzpicture}
\begin{axis}[
        xlabel=$x$,
        ylabel=$y$]
    \addplot[smooth,mark=*,blue] plot coordinates {
        (0,2)
        (2,3)
        (3,1)
    };
\end{axis}
\end{tikzpicture}
\end{document}

However, if i apply the same principle on Ubuntu 10.4 it works! So what i did is updated the latex 2009 to 2011 on my Ubuntu machine (this means update pgfplots from 1.3 to 1.5.1) and both sources work

does anyone has an idea why ??

baxy
Last edited by baxy77bax on Mon Mar 05, 2012 6:50 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

pgfplots | Move Legend outside Plot Area

Post by localghost »

Section 4.8.5 of the pgfplots manual shows which positions are accepted by the legend pos option. Make sure that you use the recent version of the package. Add the \listfiles command as very first line to your example and search the log file for the list of used files to find out which version of the package is really used.


Thorsten
Post Reply