How to Increase the Cell Width of the Jupyter/Ipython Notebook in My Browser

How do I increase the cell width of the Jupyter/ipython notebook in my browser?

If you don't want to change your default settings, and you only want to change the width of the current notebook you're working on, you can enter the following into a cell:

from IPython.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))

How to increase jupyter notebook/lab cell widths when outputting to html

Place this cell into your notebook:

# https://stackoverflow.com/questions/21971449/how-do-i-increase-the-cell-width-of-the-jupyter-ipython-notebook-in-my-browser
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))

And run you command:

jupyter nbconvert inspect.ipynb --no-input --no-prompt

Or maybe you can do it with custom.css, but I'm not sure. See the second answer in here How do I increase the cell width of the Jupyter/ipython notebook in my browser?

How to change the style/width of cells in JupyterLab?

The names of classes were reworked in JupyterLab and are now easier to understand and more predictable. Use the following selectors for JupyterLab:

  • .jp-Cell to change the width of all cells
  • .jp-Cell.jp-CodeCell to change only width of the cells with code
  • .jp-Cell.jp-MarkdownCell to change the width of markdown cells
  • .jp-Cell.jp-Editor to change width of the editor only
  • .jp-OutputArea-output to change the with of cell outputs

For example, to reduce the width of cells using IPython you could use:

from IPython.core.display import display, HTML
display(HTML("<style>.jp-Cell { width: 60% !important; }</style>"))

You can use the DOM inspector, a tool that all browsers provide nowadays, (see the instructions here) to check class names of specific elements that you wish to modify.

How do I change the width of Jupyter notebook's cell's left part?

The prompt width is set in notebook/static/notebook/less/cell.less#L80, so you could do something like:

/* Narrow the prompts */
.prompt {
min-width: 10ex;
}

/* Hide prompts altogether for non-conda cells */
.cell:not(.code_cell) .prompt {
display: none;
}

Change the cell width of a data frame in Jupyter Notebook

Use the below setting to change only for 1 column.

df.style.set_properties(subset=['ad_description'], **{'width-min': '300px'})

Edits: @Haritz Laboa: Thanks for confirming that 'width-min' works and not 'width'.



Related Topics



Leave a reply



Submit