jupyter notebook界面是可以定制的,定制位置在:C:\anaconda\Lib\site-packages\notebook\static\custom
启动jupyter notebook之后,查看网页源代码,会发现网页中会自动加载custom.css和custom.js。

于是有人推出了jupyter-themes这款主题定制工具,这个工具使用上是存在一些界面bug的。

github地址:https://github.com/dunovank/jupyter-themes

一、安装

# install jupyterthemes
pip install jupyterthemes# upgrade to latest version
pip install --upgrade jupyterthemes

二、基本用法jt -h

usage: jt [-h] [-l] [-t THEME] [-f MONOFONT] [-fs MONOSIZE] [-nf NBFONT][-nfs NBFONTSIZE] [-tf TCFONT] [-tfs TCFONTSIZE] [-dfs DFFONTSIZE][-ofs OUTFONTSIZE] [-mathfs MATHFONTSIZE] [-m MARGINS][-cursw CURSORWIDTH] [-cursc CURSORCOLOR] [-cellw CELLWIDTH][-lineh LINEHEIGHT] [-altp] [-altmd] [-altout] [-P] [-T] [-N] [-kl][-vim] [-r] [-dfonts]optional arguments:-h, --help            show this help message and exit-l, --list            list available themes-t THEME, --theme THEMEtheme name to install-f MONOFONT, --monofont MONOFONTmonospace code font-fs MONOSIZE, --monosize MONOSIZEcode font-size-nf NBFONT, --nbfont NBFONTnotebook font-nfs NBFONTSIZE, --nbfontsize NBFONTSIZEnotebook fontsize-tf TCFONT, --tcfont TCFONTtxtcell font-tfs TCFONTSIZE, --tcfontsize TCFONTSIZEtxtcell fontsize-dfs DFFONTSIZE, --dffontsize DFFONTSIZEpandas dataframe fontsize-ofs OUTFONTSIZE, --outfontsize OUTFONTSIZEoutput area fontsize-mathfs MATHFONTSIZE, --mathfontsize MATHFONTSIZEmathjax fontsize (in %)-m MARGINS, --margins MARGINSfix margins of main intro page-cursw CURSORWIDTH, --cursorwidth CURSORWIDTHset cursorwidth (px)-cursc CURSORCOLOR, --cursorcolor CURSORCOLORcursor color (r, b, g, p)-cellw CELLWIDTH, --cellwidth CELLWIDTHset cell width (px or %)-lineh LINEHEIGHT, --lineheight LINEHEIGHTcode/text line-height (%)-altp, --altprompt    alt input prompt style-altmd, --altmarkdownalt markdown cell style-altout, --altoutput  set output bg color to notebook bg-P, --hideprompt      hide cell input prompt-T, --toolbar         make toolbar visible-N, --nbname          nb name/logo visible-kl, --kernellogo     kernel logo visible-vim, --vimext        toggle styles for vim-r, --reset           reset to default theme-dfonts, --defaultfontsforce fonts to browser default

三、github上的README教程

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
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

四、 深度定制

一般设置一下主题和字体就足够普通用户使用了,例如:
jt -t monokai -f consolamono -fs 15

如果还嫌瑕疵,那就需要自己去改前端了。
~/.jupyter\custom目录下有主题、CSS、字体等。

转载于:https://www.cnblogs.com/weiyinfu/p/9697364.html

使用jupyterthemes插件定制jupyter notebook界面相关推荐

  1. 【学习笔记】2、Python - Jupyter Notebook界面基础

    Jupyter Notebook界面基础 一.模式 Jupyter Notebook有两种模式: 编辑模式:有光标在闪烁的时候,就叫做编辑模式: 命令模式:点击侧边栏,光标消失,就进入命令模式: ES ...

  2. jupyter notebook界面颜色jt_更改jupyter notebook主题颜色——步骤详解(Windows系统)...

    问题提出:在用jupyter notebook时,其默认主题颜色为白色,长时间编程比较费眼,寻求可以改变jupyter notebook主体颜色的解决方案. 适用系统:Windows8 解决方案:使用 ...

  3. 我知道你会用Jupyter Notebook,但这些插件你都会了吗?

    选自towardsdatascience 作者:William Koehrsen 机器之心编译 参与:王淑婷.路 Jupyter Notebook 虽然很方便,但其功能却捉襟见肘.通过安装一些插件,能 ...

  4. 效率倍增,5 个提高生产力的 Jupyter notebook插件

    Jupyter Notebook 因其可用性和实用性而成为数据分析和机器学习模型领域最流行的 IDE,它也是很多数据初学者的首选 IDE.它最具特色的是,拥有丰富的插件.扩展数据处理能力和提升工作效率 ...

  5. Jupyter Notebook 五大效率插件

    作者:William Koehrsen 编译:机器之心 原文:towardsdatascience.com/jupyter-notebook-extensions-517fa69d2231 Jupyt ...

  6. Jupyter Notebook 主题库 jupyterthemes 安装和使用方法

    原生的Jupyter Notebook界面主题如下: 原生主题简洁大方那个,经典易用,但总是有人热衷于纯黑色的开发界面的.下面就带大家开始体验jupyterthemes 的各种个性主题. 第一步:安装 ...

  7. 微软发布VS Code Jupyter插件!不止Python!多语言的Jupyter Notebook支持来了!

    北京时间 2020 年 11 月 12 日,微软发布了全新的 VS Code Jupyter 插件!Jupyter 插件将 Jupyter Notebook 的功能引入 VS Code,并且将会支持更 ...

  8. 微软发布 VS Code Jupyter 插件!不止 Python,多语言的 Jupyter Notebook支持来了!

    作者 | formulahendry 来源 | 玩转VS Code(ID:vs_code) 头图 |  CSDN 下载自东方IC 北京时间 2020 年 11 月 12 日,微软发布了全新的 VS C ...

  9. jupyter notebook / jupyter lab 深色主题下如何设置字体 及 如何设置绘图颜色

    在安装了jupyter notebook / jupyter lab及其深色主题之后,需要进一步设置字体,和设置绘图的颜色.否则看起来界面会比较奇怪. 本文针对这几个问题作一些说明. 文章目录 1. ...

最新文章

  1. TCP/IP详解学习笔记(9)-TCP协议概述
  2. matlab 冒号操作符
  3. Java集合中HashMap日常问题及解决办法
  4. 学校不用考直接过计算机一级,全国计算机等级考试1级是不是必须要考的啊
  5. QT每日一练day16:QMessageBox消息对话框
  6. .har 文件解析工具
  7. Stereoscopic Player播放器的控制
  8. Spring事务传播机制
  9. 淘宝宠物用品找代理方法步骤 淘宝宠物用品店怎么开
  10. ios 表情符号 键盘_iOS自定义的emoji表情键盘
  11. 線上 Android/Linux Kernel Source Code瀏覽 - Android/Linux Source Code Cross Reference
  12. 同一个实验室,硕士们进了大厂拿高薪,为什么博士却要挤破头进高校?
  13. 关于xds100仿真器的ftdi驱动无法使用的问题
  14. pandas数据分析读书笔记(四)
  15. 可以通过限定ip来限制用户重复登录么_饿了么到底有多“贼”?揭秘它一步步让你下单的套路!...
  16. Keras-yolov3计算验证集acc一直为0
  17. gpgga数据校验并提取
  18. 快乐学算法之:三分查找树ternary search tree
  19. 业余选手成就了软件开发者?
  20. 消息传递神经网络(MPNN)内容及代码实践

热门文章

  1. can总线配置读入是什么意思_Simulink(常量amp;总线amp;示波器模块)+嵌入式(AURIX入门学习记录CAN通信配置)...
  2. 夯实Java基础(二十二)——Java8新特性之Lambda表达式
  3. 题解【luogu P2421 bzoj P1407 [NOI2002]荒岛野人】
  4. 什么是数据库并发控制?数据库并发控制的主要方法是?
  5. 基于springcloud的声明式客户端FeignClients方式的httpserver访问配置
  6. psql: 致命错误: 用户 postgres Ident 认证失败
  7. [转]学会使用DB2指令
  8. 【实习之T100开发】T100 P处理开发流程
  9. 【jQuery笔记Part1】04-webstorm定义活动模板
  10. vnpy学习10_常见坑