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

I am trying to make a series of changes in the appearance of the Plot of some function. I am trying to use Manipulate for my experiments. I tried to change the following code

Manipulate[ Plot[Sin[x], {x, 0, Pi}], {p, HoldForm /@ Options[Plot]}, {q, InputField}]

so that when, for example, p is AxesOrigin ->Automatic and q is changed to {-3,5} then the plot will be updated with Axes Origin at {-3,5}. Similar if p is taken AxesLabeL->None and p is changed to "A label" then the last plot will refreshed showing the label "A label" at the top(without affecting any changes already made in other options like AxesOrigin above).

share|improve this question
maybe this can get you started? Manipulate[With[{p1=p[[1,1]]},Plot[Sin[x],{x,0,Pi},p1-> q]], {{p,{PlotLabel-> None}, "Options"},Thread[{Options[Plot]}]},{{q,Null,"Value"},InputField}] – chuy Nov 5 '13 at 19:16

Here's way along the lines in the OP:

 With[{opts = Sequence @@ opts},
  Plot[Sin[x], {x, 0, Pi}, opts]], {p, 
  PopupMenu[Dynamic[p, (q = opts[[#, -1]]; p = #) &],
    Thread[Range@Length@# -> #] &[First /@ Options[Plot]]] &},
 {{q, Null},
    Dynamic[q, (opts = ReplacePart[opts, {p, -1} -> #]; q = #) &]] &},
 {opts, None},
 TrackedSymbols :> {opts}, Initialization :> (opts = Options[Plot])

Mathematica graphics

share|improve this answer

Here's a different take on how to present the options, using SlideView rather than drop down, which is pretty nice.

I'm sorry for the fast animation, I had to drop a lot of frames to make its size decent.

{names, symbols, values} = 
  Transpose[Options[Plot] /. (Rule[x_, y_] | RuleDelayed[x_, y_]) :> {x, Unique[x], y}];
tables = 
   Partition[MapThread[Function[{name, symbol}, {
      Pane[name, 150], 
   }], {names, symbols}], 10];
MapThread[Set, {symbols, values}];
      Plot[Sin[x], {x, 0, 2 Pi}, 
       Evaluate[MapThread[Rule[#, #2] &, {names, symbols}]]], 
      BaseStyle -> {Background -> White}]],
    TableForm /@ tables


share|improve this answer
gifsicle -O3 --colors 256 original.gif > smaller.gif brings it down from 1.8M to 784K – ssch Nov 7 '13 at 22:59
@ssch Nice, I'll remember that. Exported it from MMA this time. – C. E. Nov 8 '13 at 7:11

I don't know if the following code will satisfies you. Of course one could change the code to add more controls like changing 0 and 2Pi corners e.t.c.

f[p_, pt : {___}] := Plot[p[x], {x, 0, 2 Pi}, pt]

 If[q =!= Null, PrependTo[r, p[[1, 1]] -> q]]; {p[[1, 1]] -> q, 
  f[Sin, r]}, {p, HoldForm /@ Options[Plot]}, {q, 
  InputField}, {{r, {Axes -> True}}, None}, TrackedSymbols -> {q}]

or similarly,

  Manipulate[If[q =!= Null, PrependTo[r, p[[1, 1]] -> q]]; 
 r = DeleteDuplicates[r, #1[[1]] == #2[[1]] &]; 
 Column@{r, p[[1, 1]] -> q, f[Sin, r]}, {p, 
  HoldForm /@ Options[Plot]}, {q, InputField}, {{r, {Axes -> True}}, 
  None}, TrackedSymbols -> {q}]
share|improve this answer
much much better than mine! – chuy Nov 5 '13 at 20:37

Disclaimer -> this is quick and dirty (emphasis on dirty) first attempt:

 plot[Sin[x],{x,0,Pi},Sequence@@{s,p[[1,1]]-> q}],
 {{p,{PlotLabel-> None}, "Options"},
 {{q,Null, "Value"},InputField}, 
 {{s,{}},Block[{s2},Button["Save State", s2=Append[s,p[[1,1]]-> q];DeleteDuplicates[s2];s=s2]]&}, 
  {plot[func_,{x_,xmin_,xmax_},opts:OptionsPattern[]]:= Plot[func,{x,xmin,xmax}, opts]}]

This (as badly written) has the limitations that you can pink box it with bad values for options. In order to "save a state" hit the button. Further changes should respect these previous ones.

share|improve this answer

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.