New answers tagged

7

In case you want to plot in place you can use something like: Button["Plot", NotebookWrite[ InputNotebook[], ToBoxes @ Plot[ Evaluate @ ToExpression @ CurrentValue @ "SelectionData", {x, 0, 10} ] ] ] You may want to add Method -> "Queued" for more complicated plot to avoid timeout. And if you want x from ...


7

According to the documentation, "PasteButton, evaluates its arguments in an ordinary way, so that expr is immediately evaluated" It is like you evaluate Plot[\[SelectionPlaceholder], {x, 0, 10}] which will give empty plot. This could be one solution: PasteButton["Plot", Defer[Plot[\[SelectionPlaceholder], {x, 0, 10}]]]



Top 50 recent answers are included