Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My code

q1 = {{1, 0.5}, {2, 0.5}}; q2 = 10; q3 = {3, 3};
      PlotRange -> {{0, Dynamic[q2]}, {-1, 1}},
      Axes -> True], 
    Appearance -> q3], 
  TrackedSymbols :> {q3}]

is wrong, because when I press this button

Button["Add", AppendTo[q1, {q1[[-1, 1]] + 1, 0.5}]; AppendTo[q3, 1]]

a bad output cell appears, and I get the mesage

The specified setting for the option GraphicsBoxOptions, PloRange cannot be used."

What is wrong here??

share|improve this question
I don't know but if you leave q2 without Dynamic it will work, also wrapping LocatorPane and Button with e.g. Column will prevent the error too. – Kuba Dec 29 '13 at 21:21
as Kuba said, the problem is that you wrapped q2 in Dynamics. Dynamics is for display only. Nothing that has Dynamics will be understood by the Kernel. only the FE` understands dynamics. So passing a Dynamics to PlotRange is not going to work. Dynamics should be an outermost wrapper, something that can be only handled by the FE' and not send to the kernel. – Nasser Dec 29 '13 at 23:13
From what i read about Dynamic[], I should nest them to avoid the whole LocatorPane[...] expression to be reevaluated whenever q2 changes (why would that be necessary?). Not true? – Coolwater Dec 30 '13 at 12:05
up vote 2 down vote accepted

I believe what you want is this:

q1 = {{1, 0.5}, {2, 0.5}}; q2 = 10; q3 = {3, 3};
  Graphics[{}, PlotRange -> Dynamic@{{0, q2}, {-1, 1}}, Axes -> True],
   Appearance -> q3], TrackedSymbols :> {q3}]

You can have a dynamic PlotRange, but you have to wrap the whole range specification with Dynamic.

share|improve this answer
I think there is still something missing. Try {Dynamic[LocatorPane...] , Button[...]} and later Column@{Dynamic[LocatorPane[...]], Button[...]}, with PlotRange->{{0, Dynamic@q2},{...}} – Kuba Dec 30 '13 at 7:00
Something is missing? Would you please clarify, because the code seems perfectly fine to me. – Coolwater Dec 30 '13 at 12:11
I tried Dynamic[Print[0];LocatorPane[(*Michael E2 answer, except for "TrackedSymbols:>{q3}"*)] and found that option to be unnecessary. – Coolwater Dec 30 '13 at 12:22
@Coolwater I meant, it works but I don't understand something with the behaviour of FE here. :) This answer works ok. – Kuba Dec 30 '13 at 18:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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