Interactive graphics without creating a new cell


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).

bill s

Posted 2015-05-07T22:50:01.573

Reputation: 62 963

Just a note, when you move something, this cell becomes an InputCell. – Kuba – 2015-05-08T05:47:28.087



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.


Posted 2015-05-07T22:50:01.573

Reputation: 3 267