1
$\begingroup$

Related to this question here. I dont understand why Evaluated->True does not behave properly when also using PlotLegends. For example, running the code below

f[x_, y_] := x^2 + 2 y;
Plot[Array[f[x, #1] &, 3, {1, 2}], {x, 1, 5}, PlotLegends -> Table[x, {x, 1, 3}], Evaluated -> True]

will give result with only Evaluated option which does not give the correct Legends (same thing happens if I add Evaluate before the PlotLegend list (Table[x, {x, 1, 3}]).

However, if I add Evaluate before the plotting argument, then it works fine:

Plot[Evaluate@Array[f[x, #1] &, 3, {1, 2}], {x, 1, 5}, PlotLegends -> Table[x, {x, 1, 3}]]

With Evaluated Option

Clearly, Evaluate and Evaluated works differently when there is PlotLegends. Why?

$\endgroup$
  • $\begingroup$ If relevant, Im using Mathematica 12.0.0.0 on Mac OS X $\endgroup$ – Histoscienology Feb 8 at 23:52
  • $\begingroup$ Evaluated is not a valid Plot option. It should be colored red to indicate that, but it does not. Seems like a bug to me. $\endgroup$ – Rohit Namjoshi Feb 9 at 0:49
  • $\begingroup$ Evaluated is recognized normally by Plot, although it is not documented. There were some discussions here, or here, it is very useful in some cases. Second link gives a workaround: using defined PlotStyle and LineLegend. $\endgroup$ – Alx Feb 9 at 8:42

Your Answer

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

Browse other questions tagged or ask your own question.