# Opacity of a legend fill in pgfplots

I am forced to make rather small plots that need to have a legend. This means that it is unavoidable that part of the plot gets covered by the legend.

To retain legibility of the plot, I would like to make the background of the legend partly transparent. My approach was to use legend style={fill opacity=0.8, draw opacity=1}, however, this makes the whole legend transparent, and not only the fill.

Here is an MWE:

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=1.10}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=5cm,
axis equal,
legend style={fill=white, fill opacity=0.6, draw opacity=1},
]
({cos(deg(x))}, {sin(deg(x))});
\end{axis}
\end{tikzpicture}
\end{document}


The output is:

As you can see the outline is fully drawn, but the text inside the legend is also transparent. How can avoid this, and only make the fill translucent?

text opacity =1


to your legend style command.

% arara: pdflatex
\documentclass[tikz]{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=1.10}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=5cm,
axis equal,
legend style={fill=white, fill opacity=0.6, draw opacity=1,text opacity=1},
]
\end{document}

• Note that you could also set fill=none` to achieve a similar effect. – Felix Jul 12 '16 at 14:53