Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Separate "hand-drawn" objects in Mathematica

What is the simplest / most convenient way to separate hand-drawn objects in Mathematica from programmatically generated ones?

The interactive drawing tools are convenient and useful. But if I draw something on top of the plot, it will get lost as soon as the plot is re-generated. Is there a convenient solution for this?

I could make the drawing on top of an empty plot, them combine them with the actual plot. But this is again inconvenient as I need to manually set the plot range of the empty plot and I don't see the background on top of which I'm adding the annotations.

like image 465
Szabolcs Avatar asked Oct 03 '11 12:10

Szabolcs


1 Answers

One approach, using an annotation to flag the generated content:

Plot[Annotation[Sin[x], "GeneratedPrimitives"], {x, 0, 10}]

RecoverDrawing[g_Graphics] := g /. Annotation[_, "GeneratedPrimitives"] :> {}

RecoverDrawing[<modified graphic>]

enter image description here

like image 162
Brett Champion Avatar answered Oct 26 '22 21:10

Brett Champion