# install/upgrade to latest version
pip install --upgrade jupyterthemes
Known issues
refreshing / removing / resetting: depending on your system, browser, etc., you may need to empty your browser cache after installing a new theme (-t) or attempting to restore the default (-r) in order for those changes to take effect. (see discussion here).
install issue: if you get an error saying jt is not recognized, try this fix.
# list available themes# onedork | grade3 | oceans16 | chesterish | monokai | solarizedl | solarizedd
jt -l
# select theme...
jt -t chesterish
# restore default theme# NOTE: Need to delete browser cache after running jt -r# If this doesn't work, try starting a new notebook session.
jt -r
# toggle toolbar ON and notebook name ON
jt -t grade3 -T -N
# set code font to 'Roboto Mono' 12pt# (see monospace font table below)
jt -t onedork -f roboto -fs 12
# set code font to Fira Mono, 11.5pt# 3digit font-sizes get converted into float (115-->11.5)# 2digit font-sizes > 25 get converted into float (85-->8.5)
jt -t solarizedd -f fira -fs 115
# set font/font-size of markdown (text cells) and notebook (interface)# see sans-serif & serif font tables below
jt -t oceans16 -tf merriserif -tfs 10 -nf ptsans -nfs 13
# adjust cell width (% screen width) and line height
jt -t chesterish -cellw 90% -lineh 170
# or set the cell width in pixels by leaving off the '%' sign
jt -t solarizedl -cellw 860
# fix the container-margins on the intro page (defaults to 'auto')
jt -t monokai -m 200
# adjust cursor width (in px) and make cursor red# options: b (blue), o (orange), r (red), p (purple), g (green), x (font color)
jt -t oceans16 -cursc r -cursw 5
# choose alternate prompt layout (narrower/no numbers)
jt -t grade3 -altp
# my two go-to styles# dark
jt -t onedork -fs 95 -altp -tfs 11 -nfs 115 -cellw 88%
# light
jt -t grade3 -fs 95 -altp -tfs 11 -nfs 115 -cellw 88%
Set Plotting Style (from within notebook)
jtplot.style() makes changes to matplotlib's rcParams dictionary so that figure aesthetics match those of a chosen jupyterthemes style. Note, these commands do not need to be re-run every time you generate a new plot, just once at the beginning of your notebook or whenever style changes are desired after that.
For instance, I include the following two lines in my ~/.ipython/profile_default/startup/startup.ipy file so this is done automatically whenever I open a new notebook:
# import jtplot submodule from jupyterthemesfromjupyterthemesimportjtplot# currently installed theme will be used to# set plot style if no arguments providedjtplot.style()
Some additional examples for setting "context" (taken from seaborn) and controlling various figure properties...
# import jtplotfromjupyterthemesimportjtplot# you can select an alternative theme's plot style by name# onedork | grade3 | oceans16 | chesterish | monokai | solarizedl | solarizeddjtplot.style('onedork')
# set "context" (paper, notebook, talk, or poster)# & font scale (scalar applied to labels, legend, etc.)jtplot.style('grade3', context='paper', fscale=1.4)
# turn on X- and Y-axis tick marks (default=False)# and turn off the axis grid lines (default=True)jtplot.style(ticks=True, grid=False)
# set the default figure size# x (length), y (height)jtplot.figsize(x=6., y=5.)
# or just adjust the aspect ratio# new_length = length * aspectjtplot.figsize(aspect=1.2)
# fully reset matplotlib default rcParamsjtplot.reset()