A workaround is to ReleaseHold
the plot. Plot
has gotten very complicated. I don't really know what they are trying to address exactly. Some of it has to do with data, Quantity[]
etc.; some has to do with plot themes; and then there some other stuff I don't get.
Workaround:
Manipulate[
ReleaseHold@
Plot[0.4 + 0.001 x m, {x, 0, 1400},
PlotRange -> {{0, 1400}, {0, 1.8}},
Epilog -> {Red, {Dashed,
Line[{{x, 0}, {x, 0.4 + 0.001 x m}}]}, {Dashed,
Line[{{x, 0.4 + 0.001 x m}, {0, 0.4 + 0.001 x m}}]},
Text[Style[TraditionalForm[{x, 0.4 + 0.001 x m}], Red,
FontSize -> 12], {x + .1, 0.4 + 0.001 x m + .1}]},
ImageSize -> Large], {{m, 1, "Slope"}, 0,
5}, {{x, 600, "Change in P & Q"}, 300, 1200}]
Note that is it not Manipulate
and x
being a Manipulate
variable that is the problem. It is Plot
:
x = 600;
m = 1;
Plot[0.4 + 0.001 x m, {x, 0, 1400},
PlotRange -> {{0, 1400}, {0, 1.8}},
Epilog -> {Red, {Dashed,
Line[{{x, 0}, {x, 0.4 + 0.001 x m}}]}, {Dashed,
Line[{{x, 0.4 + 0.001 x m}, {0, 0.4 + 0.001 x m}}]},
Text[Style[TraditionalForm[{x, 0.4 + 0.001 x m}], Red,
FontSize -> 12], {x + .1, 0.4 + 0.001 x m + .1}]},
ImageSize -> Large]

If you remove the Epilog
, the Plot
works fine. If you change the Plot
variable in the function and iterator from x
to y
, it works fine. It is as if someone decided that wherever the iterator variable appears in an option, it should be wrapped by HoldForm[]
, because no one could possibly want to use the global value of the variable. Maybe someone else can explain this, but it looks like a bug to me.
That said, using the same symbol in the same code for two purposes seems bad or confusing practice.
x
as the independent variable inPlot
and as a parameter inManipulate
. That's causing a conflict. Use a different variable inside theEpilog
and use that same varaiebl for theManipulate
able variable. $\endgroup$ – march Feb 4 '20 at 21:55Plot
has changed, and what used to be okay no longer is. $\endgroup$ – Michael E2 Feb 5 '20 at 1:26Plot
works, but did not update the docs. (I can see how wrappingPlotLabel
inHoldForm
is an improvement, but it was a mistake to extend the rewriting to options likeEpilog
, imho.) $\endgroup$ – Michael E2 Feb 5 '20 at 19:28