Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ipython notebook on 2 columns

I'd like to have to have cells of a python notebook on 2 columns, for writng annotations next to code (for example, instead of inserting 2 cells below, I would insert I insert a cell on the right and a cell below on the left) I know that it's possible to use custom css for changing the appearance (e.g https://github.com/nsonnad/base16-ipython-notebook/blob/master/ipython-3/output/base16-3024-dark.css ), is it possible also for the layout?

On the other hand, I found an example of how to use the css for creating a table layout (https://pixelsvsbytes.com/2012/02/this-css-layout-grid-is-no-holy-grail/), but not being very familiar with CSS I don't understand if this can be applied to an unknown number of equal blocks (unknown because they are generated interactively by the user). For reference, here is how currrently looks like:

enter image description here

like image 842
lib Avatar asked Jan 08 '23 16:01

lib


1 Answers

You could just change the cells to markdown or raw and make them float right.

from IPython.core.display import HTML
HTML("<style> div.code_cell{width: 75%;float: left;}"
    +"div.text_cell{width: 25%;float: right;}"
    +"div.text_cell div.prompt {display: none;}</style>")

Now when you enter a cell and want it on the right press esc-r (or m).
esc- unselects it and allows the notebook to process commands. r is the command to make a raw cell.

enter image description here

like image 136
brian Avatar answered Mar 08 '23 19:03

brian