如何美化jupyter notebook
主题
- 首先是主题下载,命令行如下所示:
1 | pip install --no-dependencies jupyterthemes==0.18.2 |
- 有的电脑可能会提示缺少 lesscpy,继续 pip 安装
1 | pip install lesscpy |
- 使用方法
1
2
3
4
5jt [-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]
| 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 | – |
- 我的
1 | jt -t monokai -f consolamono -fs 14 -tf consolamono -nfs 14 -tfs 14 -ofs 14 -cellw 1200 --lineh 140 -T -N |
补全
- 安装 nbextensions
1 | pip install jupyter_contrib_nbextensions |
- 安装 nbextensions_configurator
1 | pip install jupyter_nbextensions_configurator |
缺少依赖,则使用pip安装
重启jupyter,打开Nbextensions标签页,勾选Hinterland