A simple graphics command creates a red circle and a blue square:

Graphics[{Red, Disk[{0, 0}, 0.5], Blue, Rectangle[]}]

enter image description here

I can "close this up" by double clicking on the second cell to hide the code. Note the double line at the right with the tiny "up arrow" at the top, indicating that the code is hidden.

enter image description here

Now I want to edit the image using the interactive drawing tools. To do this I double click on the image, and move the shapes around. Here I've moved both the circle and the square.

enter image description here

But notice a side effect: as soon as I move one of the figures, the code pops back into view, and the image separates into its own cell. (Notice that there is no line connecting the input cell with the code and the output cell with the image.)

My question: is there a way to edit a Graphics interactively without having the code pop back into view?

This may seem an odd question. The context is that I am making a cdf that is displaying a complex image, and I want the user to be able to interact with the output by moving thing around. The problem of the code reappearing is disturbing because the large body of code displaces the image (which scrolls off the page).

  • $\begingroup$ Just a note, when you move something, this cell becomes an InputCell. $\endgroup$ – Kuba May 8 '15 at 5:47

Instead of grouping the cells, you can simply close the input cell via the menu

Cell > Cell Properties > Open

(if you are generating the whole notebook programmatically, I believe you can use CellOpen -> False).


The closed cell is indicated by the small cell bracket on top.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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