Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Background. I have a function ( stored in a package ) that creates 2D graphic images, its prototype looks like this:

  question[wi_, he_, co_] :=
   DynamicModule[{},
    Manipulate[
      Graphics[{Translate[{color, Rectangle[{0, 0}, {.8, .4}]}, 
        Tuples[{Range[width], Range[heigth]}]]}],
     {color, Red}, {width, 1, 5}, {heigth, 1, 5}, 
     Initialization :> {color = co, width = wi, heigth = he}]] 

In the actual function the Graphics function is enclosed in a Dynamic[]. The function works as expected.

Something that I don't understand happens when I do the following: 1) right-click ( Windows ) on an image and paste the image to elsewhere in the notebook; 2) repeat this for several different width / height combinations. 3) save the notebook 4) open the notebook 5) execute the function but with a different color, THEN: the color of the pasted images changes as well.

Question: How can I permanently copy and paste ( not, in any way, linked to code ) a graphic created in a Notebook with Graphics2D?

EDIT(2) per request of halirutan :

Cell[BoxData[ GraphicsBox[GeometricTransformationBox[GeometricTransformationBox[ DynamicBox[TypesetToBoxes[ MapThread[FEY2Y2Privatefun$$93, {FE`Y2`Y2`Private`ptlst$$93, FE`Y2`Y2`Private`tplst$$93, FE`Y2`Y2`Private`colst$$93}], StandardForm, Graphics], ImageSizeCache->{{89.7606933090101, 182.2393066909899}, {81.76069330901011, 169.2393066909899}}], {{{{1, 0}, {0, 1}}, {0, 0}}, {{{-1, 0}, {0, 1}}, {1, 0}}, {{{1, 0}, {0, -1}}, {0, 1}}, {{{-1, 0}, {0, -1}}, {1, 1}}}], {{{0, 0}}, {{-0.7071067811865475, 0.7071067811865475}}, {{0.7071067811865475, 0.7071067811865475}}, {{0, 1.4142135623730951}}}], PlotRegion->Automatic]], "Input"]

share|improve this question
    
Does not happen here (MacOSX). Can you go on such a pasted graphics, press Ctrl+Shift+E (Cell -> Show Expression) and post the output here? And it would be helpful if you would specify the system you are using (OperatingSystem, Mma Version, ..) –  halirutan Jun 7 '12 at 12:46
    
@halirutan - I use Windows 7, Mathematica 8. –  ndroock1 Jun 7 '12 at 13:00
    
Then someone with Windows has to fix this, because your Cell-data still contains the dynamically updated front-end variables. This is not the case here. It seems you are not copying the image only. –  halirutan Jun 7 '12 at 13:02
    
Question: You click first with left-click on the image, then the image gets a frame. Then you make right-click and go on copy-graphic. If you insert this and press Ctrl+Shit+E you such a long cell-expression like the above one? –  halirutan Jun 7 '12 at 13:05
2  
I'm on Windows 7 and Mathematica 8 too, and I can't reproduce this. Copy/paste of the graphic produced by e.g. question[3, 5, Red] yields for me a cell lacking the DynamicBox and without reference to any FE variables. –  Oleksandr R. Jun 7 '12 at 17:56
show 3 more comments

1 Answer

up vote 5 down vote accepted

I can't reproduce this either but assuming that what you want is for your copied graphic to stop updating ...right? In that case when you copy and paste just highlight the cell bracket in the pasted cell and from the menu Evaluation > Convert Dynamic To Literal. This will remove the dynamic updating. You could also try pasting the graphic into an input cell:

pasted graphic /. Dynamic -> Identity

and evaluate and see if that works (I've had success with that in the past).

share|improve this answer
    
Convert Dynamic To Literal is what I was looking for. All I could find about it in the document was a one sentence cryptic description. "Convert Dynamic to Literal - replaces each selected dynamic object with its most recent static value." How was I was supposed to know this ? –  ndroock1 Jun 8 '12 at 9:31
add comment

Your Answer

 
discard

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.