4
$\begingroup$

Bug introduced in 11.0.0. Fixed in 11.1.0.


Why is it that:

Plot[{x^2}, {x, 0, 1}, PlotLegends -> {"a"}]

does fine, but:

funcs={x^2};
Plot[funcs, {x, 0, 1}, PlotLegends -> {"a"}]

makes the legend disappear?

Please note that clearly this is a toy example, so a workaround is not the issue here. I would like to understand what is going on. Is it related to what Plot[] looks for in its first argument? I know that funcs==={x^2}, so that is a list of functions of x, which it should be.

Thanx.

$\endgroup$
  • 3
    $\begingroup$ It might be side effect due to the HoldAll property of Plot. Try Plot[Evaluate@funcs, {x, 0, 1}, PlotLegends -> {"a"}] $\endgroup$ – Nasser Jan 16 '17 at 23:41
  • $\begingroup$ I can't reproduce your result. If I run your code, the legend is drawn as expected. Which version of Mathematica do you use? $\endgroup$ – Felix Jan 17 '17 at 0:06
  • $\begingroup$ @Felix in version 11.0.1 the legend do indeed disappear. But adding Evaluate they show up. $\endgroup$ – Nasser Jan 17 '17 at 0:09
  • 1
    $\begingroup$ That's remarkable, considering that they don't disappear in 11.0.0. I have updated to 11.0.1 and can confirm that they now do disappear. $\endgroup$ – Felix Jan 17 '17 at 1:44
  • 2
    $\begingroup$ It's a bug. It's fixed in the upcoming release, and I'll update this once that's out the door. $\endgroup$ – rcollyer Mar 14 '17 at 14:39
1
$\begingroup$

On the upcoming release, this works fine.

enter image description here

$\endgroup$

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.