It is known that the instruction LegendFunction can be used to set the background color of the legend in a Plot or ListPlot, e.g.,

ListPlot[Range[0, 10], Joined -> True, 
 PlotLegends -> 
  Placed[PointLegend[{"Title"}, LegendFunction -> (Framed[#, Background -> White] &)], {Right, Top}]

Result of the plot

However, I haven't found a way to set the transparency (or opacity) of the background. If I don't specify any background color, then the legend is overlapped by the plots; if I set it to, say, white as in the example above, then the legend covers the curves I'm plotting. Is there anything in between?

  • 4
    $\begingroup$ Change the background to Background -> Opacity[0, White] However, presumably the location of the legend was chosen to demonstrate whether the background was transparent rather than the final desired location. $\endgroup$
    – Bob Hanlon
    Jul 31 at 16:02
  • $\begingroup$ Yeah sure, in this example I could have simply moved the legend elsewhere, but in other cases it wouldn't help, as I have curves everywhere in the plot. Anyway it works, thanks! $\endgroup$ Jul 31 at 16:24

1 Answer 1


I suggest using Transparent directly as the most idiomatic short alternative, but you can also use Opacity as suggested by @BobHanlon in the comments.

    Range[0, 10]
    , Joined -> True
    , PlotTheme->"Scientific"
    , PlotLegends -> Placed[
            , LegendFunction -> (Framed[#, Background -> Transparent] &)
        , {Right, Top}

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.