For readers information, cross posted and answered on Mathematica.SE:
How to paste an equation to a graphics
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 the selection to be scoped properly, e.g. to give a plot even if x already has a value, then wrap the procedure inside the Button with Block[{x},...].
