1

I am using Colorbrewer with PGFplots and I want the legend to be outside of the graph. The LaTeX environment is Texlive 2014.

Here is a MWE:

\documentclass{article}
\usepackage{pgfplots}   
\usepgfplotslibrary{colorbrewer}
\pgfplotsset{compat=1.11}

\begin{document}

\begin{figure}
  \centering
  \begin{tikzpicture}
    \begin{axis}[
        colorbrewer cycle list=Set1,
        legend columns=-1,
        legend entries={1, 2, 3, 4},
        legend to name=values,
      ]
      \addplot {rnd};
      \addplot {rnd-1};
      \addplot {rnd-2};
      \addplot {rnd-3};
    \end{axis}
  \end{tikzpicture}

  \ref{values}
\end{figure}

\end{document}

But I get the error I do not know the key '/tikz/colorbrewer1' and the legend is plotted, but colorless:

Colorless legend outside of the graph

The Colorbrewer code source comes from the Launchpad repo (posted as an answer to the question Pre-defined color cycles à la RColorBrewer?).

In a very similar question to this one, tikz legend in caption and colorbrewer, the answer is to use the Colorbrewer source code from the Git repo.

But, I prefer the marks from the first code...

Is it possible to have the legend outside of the graph with the implementation of Colorbrewer from Launchpad, or am I better off using my custom marks for the implementation from Git?

Neraste
  • 333
  • You should consider updating your system. As of version 1.13 pgfplots has build in colorbrewer support. – Benjamin May 04 '16 at 21:11
  • That is good to hear and cuts the problem down. Unfortunately, I work in a corporate environment and updating my LaTeX distribution is not an option. – Neraste May 09 '16 at 09:56

0 Answers0