In this tutorial, we're going to see multiple ways to increase the cell width of Jupyter Notebook.
1. Increase width of current Notebook
If we need a temporary increase of the cell width of your Jupyter Notebook. This solution is perfect if we don't need to install plugins or change settings.
Run this code in a new cell:
from IPython.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
It will change the input and the output cells. This works for code and markdown cells.
It also shows a way to customize your Jupyter Notebook temporarily by modifying CSS.
2. Custom CSS settings
Next we can change more CSS styles in order to change outlook of the Jupyter Notebook like:
from IPython.core.display import display, HTML
display(HTML("<style>.container { width:100% !important; }</style>"))
display(HTML("<style>.output_result { max-width:100% !important; }</style>"))
display(HTML("<style>.prompt { display:none !important; }</style>"))
If we need to make the changes permanent we can locate the CSS file: custom.css
. Depending on your system it will be located in different places.
For Linux and virtual environments check:
~/.jupyter/custom/custom.css
3. Change width by Jupyter Themes
One more way to change the width of the Jupyter Notebook cell is by using themes.
Example command will be:
jt -t chesterish -f fira -fs 14 -cellw 100%
This will increase the cell width to 100%. Also you will be able to change the font and the font size.
To learn more about Jupyter Themes visit: jupyter-themes
4. Use JupyterLab
My favorite solution is to use JupyterLab. By default will use the available space.
It offers many features and plugins like:
- file browser
- terminal
- TOC
In most cases it will be installed together with the Jupyter Notebook. So we will need only to run it by: jupyter lab
or jupyter-lab
.
If we need to install it:
pip install jupyterlab
More can be found here: jupyterlab