gwr pointed out an apparent problem with setting a default Option value of PlotLegends for DateListPlot. I traced the problem to the existence of PlotLegends -> "Expressions" in the default PlotTheme. This is true for ListPlot as well. Since the explicit options within the Plot Theme override options set with SetOptions it appears that our option is ignored.

Actually "Expressions" is used across many Themes for ListPlot:

PlotLegends /. Charting`ResolvePlotTheme["Default", ListPlot] & /@
  {"Default", "Web", "Classic", "Detailed", "Scientific"}
{"Expressions", "Expressions", "Expressions", "Expressions", "Expressions"}

Why would this be? This option value doesn't seem to even work with these plot types, i.e.

dat = Table[{k, PDF[BinomialDistribution[50, p], k]}, {p, {0.3, 0.5, 0.8}}, {k, 0, 50}];

ListPlot[dat, Filling -> Axis, PlotLegends -> "Expressions"]

enter image description here

However it does cause the Themes to ignore a manually set default PlotLegends value:

SetOptions[ListPlot, PlotLegends -> PointLegend[Automatic, {"one", "two", "three"}]];

ListPlot[dat, Filling -> Axis]

enter image description here

Observe that turning off the Plot Theme causes the legend to suddenly appear:

 ListPlot[dat, Filling -> Axis, PlotTheme -> None]

enter image description here

Unless PlotLegends -> "Expressions" has some desirable effect I have failed to observe this seems like plainly undesirable behavior. Was the inclusion of PlotLegends -> "Expressions" in the Themes for ListPlot and related functions a mistake?

(All observations made in Mathematica 10.1.0 under Windows.)

  • $\begingroup$ I reported it. Thanks for pointing it out. $\endgroup$
    – rcollyer
    Jul 27, 2015 at 13:08
  • $\begingroup$ @rcollyer You're welcome and thank you too. $\endgroup$
    – Mr.Wizard
    Jul 27, 2015 at 13:29
  • $\begingroup$ @MinHsuanPeng Would you care to post that as an answer? $\endgroup$
    – Mr.Wizard
    Jul 27, 2015 at 22:04
  • $\begingroup$ @Mr.Wizard Okay, I will. $\endgroup$ Jul 27, 2015 at 22:48

2 Answers 2


"Expressions" for legend in ListPlot family is used because of Association. With Association input, the plot will automatically pick up the keys as legends. Here is an example:


enter image description here

SetOptions is to set the default values to options but it doesn't guarantee that the settings will be used by the plot since PlotTheme has been introduced.

The workaround would be to pack a set of options you would like to use through out the session in a variable and use it instead of using SetOptions.


The problem appears to be with specifying Automatic for the colors with PointLegend rather than letting it default.


"10.2.0 for Mac OS X x86 (64-bit) (July 7, 2015)"

pValues = {0.3, 0.5, 0.8};

dat = Table[{k, PDF[BinomialDistribution[50, p], k]}, {p, pValues}, {k, 0, 50}];

ListPlot[dat, Filling -> Axis, 
 PlotLegends -> PointLegend[("p = " <> ToString[#] & /@ pValues)]]

enter image description here

Or just use

ListPlot[dat, Filling -> Axis, PlotLegends -> ("p = " <> ToString[#] & /@ pValues)]
  • $\begingroup$ Bob Hanlon, I am afraid I did not craft my question clearly enough. The trouble is not manifest when the PlotLegends option is given directly to ListPlot, but rather when it is first set with SetOptions or Options[ListPlot] = . . .. Direct specification works as it supersedes Theme options. My question is really about Themes and why "Expressions" is used at all. $\endgroup$
    – Mr.Wizard
    Jul 25, 2015 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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