5
$\begingroup$

I have created a CDF file that contains a Manipulate object with a plot. I intend to embed the file in a web site, so that users can use interactive sliders to change the parameters of the plot.

My problem is that when opening the CDF file in a browser, the user can double-click on the plot and edit it (move lines, move points, etc.). The only interactive content I want in the web site are the sliders produced by Manipulate. How can I create a CDF file that doesn't allow the user to edit the plot?

$\endgroup$
1
  • $\begingroup$ Could you be more specific on the 'buggy behaviour' part? Perhaps you could post a simplified example so that we can investigate it more closely. $\endgroup$ Apr 19, 2012 at 13:21

1 Answer 1

7
$\begingroup$

Wrap the output of the CDF (the Plot command in your case) into Deploy, or add the Deployed -> True option to your Manipulate.

Using the Deployed option however does not solve all the problems. The documentation states, that Deployed -> True disables:

...general editing and selection in a cell

General editing/selection means that in the following example one can not select individual expressions of the list (e.g. "text"), but still graphics editing is possible, as the screenshot clearly shows:

Manipulate[{"text", Plot[x^n, {x, 0, 3}]}, {n, 0, 10}, Deployed -> True]

Mathematica graphics

Thus to make output really bulletproof, wrap each Graphics object into Deploy as well:

Manipulate[{"text", Deploy@Plot[x^n, {x, 0, 3}]}, {n, 0, 10}, Deployed -> True]
$\endgroup$
7
  • $\begingroup$ Adding the Deploy->True option to Manipulate doesn't lead to the desired result and produces buggy behavior. Wrapping the Plot command with Deploy, however, does exactly what I need - thank you! $\endgroup$
    – Joe
    Apr 19, 2012 at 12:18
  • $\begingroup$ To answer @István-Zachar, the buggy behavior is manifested, for example, in the output of: Manipulate[Plot[x^n,{x,0,3}],{n,0,10},Deployed->True]. Usually when I evaluate this expression, I can edit the result once by double clicking, and only after the first edit it becomes immune to further editing. I say 'usually' because the result is not completely predictable. I'm using version 8.0.4.0. $\endgroup$
    – Joe
    Apr 19, 2012 at 13:40
  • $\begingroup$ @Joe please see my update. I wasn't aware of this situation, though I'm pretty sure that I ran into this before, and that's why now I prefer Deploy over Deployed. $\endgroup$ Apr 19, 2012 at 14:10
  • $\begingroup$ You have answered my question completely, I'm just curious: Why do you use both Deploy and Deployed? What do you achieve by using the Deployed->True option, that is not already achieved by wrapping the Plot function with Deploy? $\endgroup$
    – Joe
    Apr 20, 2012 at 11:40
  • $\begingroup$ @Joe: As you see, the actual output of the Manipulate (that is displayed) is a list: the Deployed option prevents e.g. selecting members of this list, but does not prevent editing Graphics, so the Plot must be wrapped in Deploy. Just try the whole thing withouth the Deployed->True option, and you will see that you can select "text", or different parts of the list. $\endgroup$ Apr 20, 2012 at 11:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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