当前位置: 首页 > 软件库 > 神经网络/人工智能 > >

jupyter-themes

Custom Jupyter Notebook Themes
授权协议 MIT License
开发语言 Python
所属分类 神经网络/人工智能
软件类型 开源软件
地区 不详
投 递 者 柴嘉年
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

jupyterthemes

Theme-ify your Jupyter Notebooks!

Author Version Status Demo
Kyle Dunovan

Updates


Scaling Back Support:

As anyone who has opened a bug report or feature request in the last several years can attest, I have begun scaling back support for the jupyter-themes package - mostly due to my personal preference for using Jupyter Lab over Jupyter Notebook classic (see update below for two of my JupyterLab theme repos).

For those with continued interest in using jupyter-themes I am planning to write up a tutorial for how to add your own custom themes to your local jt installation as well as a contributing guide for those who would like submit pull-requests to the official pacakge.

I'll also take this opportunity to say thank you to everyone who regularly used, expressed appreciation for, and contributed to jupyter-themes. I'm particularly grateful to those of you who bothered to submit pull requests - adding many excellent features that I was either too short-sighted to anticipate or simply incapable of implementing on my own. So, thank you, sincerely.

JupyterLab Themes:

Finally got around to creating a pair of themes for JupyterLab with similar style and design conventions to the jupyter-themes package:


JT Customizable Features

plotting style

markdown/equations

pandas dataframes

command palette

Links

Requirements

  • Python 3.4, 3.5, 3.6, 3.7 and 3.8
  • Jupyter (Anaconda recommended)
  • matplotlib

Install with pip

# install jupyterthemes
pip install jupyterthemes

# upgrade to latest version
pip install --upgrade jupyterthemes

Install with conda

# install jupyterthemes
conda install -c conda-forge jupyterthemes

# update to latest version
conda update jupyterthemes

Known issues

  • for best results: use notebook>=5.6.0 (pip install --upgrade notebook)
  • 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). At the very least you'll need to refresh your browser window (usually cmd+r or ctrl+r).
  • install issue: if you get an error saying jt is not recognized, try this fix.
  • slow render when scrolling: fix available here

Command Line Usage

jt  [-h] [-l] [-t THEME] [-f MONOFONT] [-fs MONOSIZE] [-nf NBFONT]
    [-nfs NBFONTSIZE] [-tf TCFONT] [-tfs TCFONTSIZE] [-dfs DFFONTSIZE]
    [-m MARGINS] [-cursw CURSORWIDTH] [-cursc CURSORCOLOR] [-vim]
    [-cellw CELLWIDTH] [-lineh LINEHEIGHT] [-altp] [-altmd] [-altout]
    [-P] [-T] [-N] [-r] [-dfonts]

Description of Command Line options

cl options arg default
Usage help -h --
List Themes -l --
Theme Name to Install -t --
Code Font -f --
Code Font-Size -fs 11
Notebook Font -nf --
Notebook Font Size -nfs 13
Text/MD Cell Font -tf --
Text/MD Cell Fontsize -tfs 13
Pandas DF Fontsize -dfs 9
Output Area Fontsize -ofs 8.5
Mathjax Fontsize (%) -mathfs 100
Intro Page Margins -m auto
Cell Width -cellw 980
Line Height -lineh 170
Cursor Width -cursw 2
Cursor Color -cursc --
Alt Prompt Layout -altp --
Alt Markdown BG Color -altmd --
Alt Output BG Color -altout --
Style Vim NBExt* -vim --
Toolbar Visible -T --
Name & Logo Visible -N --
Kernel Logo Visible -kl --
Reset Default Theme -r --
Force Default Fonts -dfonts --

Command Line Examples

# 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

# toggle kernel logo.  kernel logo is in same container as name
# toggled with -N.  That means that making the kernel logo visible is
# pointless without also making the name visible
jt -t grade3 -N -kl

# 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% -T
# light
jt -t grade3 -fs 95 -altp -tfs 11 -nfs 115 -cellw 88% -T

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. In addition to setting the color scheme, jtplot.style() allows you to control various figure properties (spines, grid, font scale, etc.) as well as the plotting "context" (borrowed from seaborn).

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.

Pro-tip: Include the following two lines in ~/.ipython/profile_default/startup/startup.ipy file to set plotting style automatically whenever you start a notebook:

# import jtplot submodule from jupyterthemes
from jupyterthemes import jtplot

# currently installed theme will be used to
# set plot style if no arguments provided
jtplot.style()

jtplot.style() Examples

# import jtplot module in notebook
from jupyterthemes import jtplot

# choose which theme to inherit plotting style from
# onedork | grade3 | oceans16 | chesterish | monokai | solarizedl | solarizedd
jtplot.style(theme='onedork')

# set "context" (paper, notebook, talk, poster)
# scale font-size of ticklabels, legend, etc.
# remove spines from x and y axes and make grid dashed
jtplot.style(context='talk', fscale=1.4, spines=False, gridlines='--')

# turn on X- and Y-axis tick marks (default=False)
# turn off the axis grid lines (default=True)
# and set the default figure size
jtplot.style(ticks=True, grid=False, figsize=(6, 4.5))

# reset default matplotlib rcParams
jtplot.reset()

Monospace Fonts (code cells)

-f arg Monospace Font
anka Anka/Coder
anonymous Anonymous Pro
aurulent Aurulent Sans Mono
bitstream Bitstream Vera Sans Mono
bpmono BPmono
code Code New Roman
consolamono Consolamono
cousine Cousine
dejavu DejaVu Sans Mono
droidmono Droid Sans Mono
fira Fira Mono
firacode Fira Code
generic Generic Mono
hack Hack
hasklig Hasklig
inconsolata Inconsolata-g
inputmono Input Mono
iosevka Iosevka
liberation Liberation Mono
meslo Meslo
office Office Code Pro
oxygen Oxygen Mono
roboto Roboto Mono
saxmono saxMono
source Source Code Pro
sourcemed Source Code Pro Medium
sudovar Sudo Variable
ptmono PT Mono
ubuntu Ubuntu Mono

Sans-Serif Fonts

-nf/-tf arg Sans-Serif Font
opensans Open Sans
droidsans Droid Sans
exosans Exo_2
latosans Lato
ptsans PT Sans
robotosans Roboto
sourcesans Source Sans Pro

Serif Fonts

-nf/-tf arg Serif Font
loraserif Lora
ptserif PT Serif
georgiaserif Georgia
cardoserif Cardo
crimsonserif Crimson Text
ebserif EB Garamond
merriserif Merriweather
neutonserif Neuton
goudyserif Sorts Mill Goudy
  • jupyter-themes配置 # 我的配置 jt -t onedork -f hasklig -fs 12 -T -cellw 1200 -lineh 185 -tfs 12 -ofs 10 具体的字符含义见官方文件 jupyterthemes

  • 此为本人自译(非机器,纯人肉),水平有限,望多多包涵。 毕恭毕敬地贴上原文地址 # 我自己的设置:grade3主题(亮色),显示工具栏、文件名,代码 fira 字体,输出区字体大小 13pt jt -t grade3 -T -N -kl -f fira -ofs 13 jupyterthemes Theme-ify your Jupyter Notebooks! 相关链接 jupyterthem

  • Jupyter想要更换成深色主题怎么办? 1.安装Jupyter主题 在cmd中输入 pip install jupyterthemes 2.查看都有哪些主题 在cmd中输入 jt -l 3.更换所需要的主题 jt -t onedork -f fira -fs 13 -cellw 90% -ofs 11 -dfs 11 -T -T -t 主题 -f 字体  -fs 字体大小  -cellw 宽度 

 相关资料
  • Jupyter notebook is formerly known as IPython notebook, it is a tool that helps you create readable analyses. Jupyter works with python kernel by default, but it also supports many other kernels. Keyb

  • Beyond Jupyter Notebooks �� All material from the PyCon.DE 2018 Talk "Beyond Jupyter Notebooks - Building your own data science platform with Python & Docker" Resources of the presentation Video of th

  • OCaml Jupyter An OCaml kernel for Jupyter notebook. This provides an OCaml REPL with a great user interface such as markdown/HTML documentation, LaTeX formula by MathJax, and image embedding. Getting

  • mkdocs-jupyter: Use Jupyter Notebooks in mkdocs Add Jupyter Notebooks directly to the mkdocs navigation Support for multiple formats: .ipynb and .py files (using jupytext) Same style as regular Jupyte

  • Guide for Reproducible Research and Data Science in Jupyter Notebooks This guide is a community-resource of crowdsourced guidelines and tutorials for reproducible research in Jupyter Notebooks. This r

  • A plugin for JupyterLab that lets you set up and use as many filebrowsers as you like, connected to whatever local and/or remote filesystem-like resources you want. The backend is built on top of PyFi

  • Jupyter DataTables Jupyter Notebook extension to leverage pandas DataFrames by integrating DataTables JS. About Data scientists and in fact many developers work with pd.DataFrame on daily basis to int

  • Jupyter Dash This library makes it easy to develop Plotly Dash apps interactively from within Jupyter environments (e.g. classic Notebook, JupyterLab, Visual Studio Code notebooks, nteract, PyCharm no