Now Reading
What Are Jupyter Themes And How To Apply Them?

What Are Jupyter Themes And How To Apply Them?

Rohit Yadav
jupyter themes
W3Schools

Jupyter themes are a great way to beautify your notebook and get a dark mode, which is popular among programmers. Jupyter Notebook, unlike other editors/IDEs by default, has a white background. This can be annoying for people who like to code for extended hours. However, you can change the theme of your notebook from a wide range of available options.

Jupyter Notebook, although not an integrated development environment, is popular among data scientists for analysing, visualising, and communicating the data findings. As per the Python Developer Survey 2019, Jupyter Notebook was only behind PyCharm and VS Code in the most popular editor/IDE category. Over the years, Jupyter Notebook has become the go-to editor for data scientists due to its ease-of-use and effectiveness in working with various environments, which can be created using Conda, Docker, or Virtualenv.

However, Jupyter Notebook is losing its popularity as data scientists are now embracing IDEs that can manage end-to-end machine learning workflows. But, Jupyter Notebook is still popular among researchers who are less concerned about writing production-level code and more about innovating.



Also Read: Top 5 Online Resources To Learn Jupyter Notebook

Jupyter Themes

The themes can be used to change not only background colour but also the style of the text. Besides, you can also customise the text in markdown, pandas’ dataframe font size, cell width and height, cursor colour, visibility of toolbar, and more. Furthermore, you can set the plotting style with jtplot.style() to beautify your visualisations generated with matplotlib. One can also mould figure properties like grid, spines, and more.

Installing Jupyter Themes 

Before applying from the available themes, you will have to install the themes from the package managers of your choice — pip or conda.

With pip:

pip install jupyterthemes

With Conda:

conda install -c conda-forge jupyterthemes

On using conda command in Anaconda Prompt, you will see a list of packages that are to be installed. However, your list of necessary packages might slightly vary if you already have some of the required packages.

After successfully installing packages, you can either change the theme right from the Anaconda Prompt or can directly start Jupyter Notebook and then apply the theme.

Currently, there are 9 themes available, which you can see with the below command:

jt -l

You will see a list of themes: chesterish, grade3, gruvboxd, gruvboxl, manokai, oceans16, onedork, solarizedd, solarizedl.

However, you can use the above command with ‘!’ in the beginning on the notebook to check the list: i.e.: !jt -l 

Now you can select from the list and apply it using the below command within the Anaconda Prompt:

jt -t <name of the theme>

For e.g.: jt -t chesterish

Now, start the Jupyter Notebook from Anaconda Prompt with the below command:

jupyter notebook

Jupyter notebook with the chesterish theme below: 

By default, the theme hides the toolbar and notebook’s name. But you can toggle it with the below command:

jt -t grade3 -T -N (to display the toolbar and notebook’s name)

See Also

You can also reverse the theme within the notebook:

!jt -r

However, you will have to refresh your notebook to see the changes.

Some of the other customisations that you can try are: –

Changing the font: !jt -t solarizedd -f fira -fs 115

Adjusting cell width: !jt -t chesterish -cellw 90% -linech 170

Cursor width and colour: !jt -t oceans16 -cursc r -cursw 5

Plotting With The Theme

The jupyterthemes library also allows you to make appealing visualisation with its submodule jtplot. Import the module and use its style() method to change figure properties.

#import the module
from jupyterthemes import jtplot

Examples of how the style() method can be used to beautify your visualisation: –

Outlook

Jupyter themes are an effective way to change the aesthetics of your notebook by making the most out of the available themes. One of the prime reasons behind the popularity of the themes is the feature to modify your plots created through matplotlib. With the jupyterthemes library, you can take your visualisation to the next level.

Link to the jupyterthemes’ GitHub repository.

What Do You Think?

If you loved this story, do join our Telegram Community.


Also, you can write for us and be one of the 500+ experts who have contributed stories at AIM. Share your nominations here.
What's Your Reaction?
Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0

Copyright Analytics India Magazine Pvt Ltd

Scroll To Top