首页 最新 热门 推荐

  • 首页
  • 最新
  • 热门
  • 推荐

Jupyter notebook系列(5):主题的安装更换(主题颜色背景,字体字号大小,工具条可见,画图风格设置)

  • 25-03-03 18:42
  • 3790
  • 9145
blog.csdn.net

Jupyter notebook 系列

Jupyter notebook系列(1):安装与使用(安装,虚拟环境的联接使用,windows远程连接linux的jupyter)

Jupyter notebook系列(2):使用技巧(快捷键,多行输出,多光标操作,Unix系统命令的使用,查看输入输出历史,保存记录点与分享,抑制文末输出,图片输出,多环境kernel切换)

Jupyter notebook系列(3):魔法函数(查询,运行外部程序,计时,加载文件,变量管理调试,shell交互,图片的显示,查询环境变量,显示运行内核函数,kernel切换)

Jupyter notebook系列(4):插件的安装使用(代码折叠,添加目录,变量监控,代码格式化,运行时间统计,自动补全,自动保存,运行结束提醒)

Jupyter notebook系列(5):主题的安装更换(主题颜色背景,字体字号大小,工具条可见,画图风格设置)

Jupyter notebook系列(6):更高级的配置Mark(显示行号,更改工作路径,使用sudo权限)

文章目录

  • Jupyter notebook 系列
  • 0、前言
  • 1、主题安装
    • 5.1 使用最基本简便的pip,安装jupyterthemes
    • 5.2 更新到最新版本的jupyterthemes
  • 2、查看主题,选择主题,和一些主题参数配置(字体,字号等等)
    • 2.1 查看可用的jupytertheme主题
    • 2.2 使用-t选项选择主题
    • 2.3 设置代码字体和字号
    • 2.4 设置工具条NAME等
    • 2.5 看一下其他选项
  • 3 分享一个我的设置
  • 4 恢复原主题
  • 5 画图风格的设置
  • LAST、参考文献

0、前言

Jupyter的主题是白色的比较伤眼睛另外字体也不好看。接下来主要修改windows默认的jupyter主题。

1、主题安装

5.1 使用最基本简便的pip,安装jupyterthemes

pip install jupyterthemes 
  • 1

5.2 更新到最新版本的jupyterthemes

pip install --upgrade jupytertheme
  • 1

2、查看主题,选择主题,和一些主题参数配置(字体,字号等等)

不想细看的可以直接调到第三章看一下我的设置就可以啦

2.1 查看可用的jupytertheme主题

jt -l 
  • 1

image-20201109191253381

2.2 使用-t选项选择主题

最后一位的d应该是dark的缩写

最后一位的l应该是light的缩写

jt -t 主题名字
  • 1
主题文件框示例代码框示例
chesterishimage-20201109191828996image-20201109192954296
grade3image-20201109191853532image-20201109193234889
gruvboxdimage-20201109192317486image-20201109193221318
gruvboxlimage-20201109192338877image-20201109193207115
monokaiimage-20201109192410888image-20201109193041631
oceans16image-20201109192438673image-20201109193151445
onedorkimage-20201109192512202image-20201109193132904
solarizeddimage-20201109192537060image-20201109193013357
solarizedlimage-20201109192613094

2.3 设置代码字体和字号

上面设置结束后字体并没有变化,这是因为我们并没有指定字体。

使用-f选项设置字体

jt -t chesterish -f roboto -fs 12   #设置主题为chesterish,字体为roboto,字体大小为12 
  • 1

效果如下:

image-20201109193755317

2.4 设置工具条NAME等

我们发现字体发生了变化,舒服多了,但是原来菜单栏下方的工具条不见了,文件名也没有了。

显示工具条、log

使用-T命令使工具条可见,使用-N使Name和logo可见

jt -t onedork -f roboto -fs 12 -T -N
  • 1

执行完后刷新页面,效果如下

image-20201109194203512

2.5 看一下其他选项

-tf 设置markdown的字体
-tfs 设置markdown字体大小
-dfs 设置Pandas DataFrame的字体大小
-ofs 设置输出的字体大小
-altp 关掉输入输出前面的数字
…其他详见官网

image-20201109200014900

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 THEME
                        theme name to install
  -f MONOFONT, --monofont MONOFONT
                        monospace code font
  -fs MONOSIZE, --monosize MONOSIZE
                        code font-size
  -nf NBFONT, --nbfont NBFONT
                        notebook font
  -nfs NBFONTSIZE, --nbfontsize NBFONTSIZE
                        notebook fontsize
  -tf TCFONT, --tcfont TCFONT
                        txtcell font
  -tfs TCFONTSIZE, --tcfontsize TCFONTSIZE
                        txtcell fontsize
  -dfs DFFONTSIZE, --dffontsize DFFONTSIZE
                        pandas dataframe fontsize
  -ofs OUTFONTSIZE, --outfontsize OUTFONTSIZE
                        output area fontsize
  -mathfs MATHFONTSIZE, --mathfontsize MATHFONTSIZE
                        mathjax fontsize (in %)
  -m MARGINS, --margins MARGINS
                        fix margins of main intro page
  -cursw CURSORWIDTH, --cursorwidth CURSORWIDTH
                        set cursorwidth (px)
  -cursc CURSORCOLOR, --cursorcolor CURSORCOLOR
                        cursor color (r, b, g, p)
  -cellw CELLWIDTH, --cellwidth CELLWIDTH
                        set cell width (px or %)
  -lineh LINEHEIGHT, --lineheight LINEHEIGHT
                        code/text line-height (%)
  -altp, --altprompt    alt input prompt style
  -altmd, --altmarkdown
                        alt 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, --defaultfonts
                        force fonts to browser default
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52

3 分享一个我的设置

jt -t oceans16 -f roboto -fs 13 -cellw 90% -ofs 11 -dfs 11 -T -N
  • 1

4 恢复原主题

如果你不想使用现在的主题,可以使用-r选项进行重置

jt -r
  • 1

5 画图风格的设置

我们可以使用jtplot设置matplotlib的rcParams字典属性,以便图形风格能够适配我们选择的主题。

from jupyterthemes import jtplot
jtplot.style(theme='onedork') #选择一个绘图主题
#设置绘图的额风格,如坐标轴字体,网格样式等
jtplot.style(context='talk', fscale=1.4, spines=False, gridlines='--')
#设置坐标轴,网格的开闭,图形大小等
jtplot.style(ticks=True, grid=False, figsize=(6, 4.5))
#重置设置
jtplot.reset()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

LAST、参考文献

用SSH远程使用Jupyter – 霏霏在此

你可能并不知道这样定制炫酷的jupyter主题_计算机基础,职能岗位_超哥的杂货铺-商业新知

jupyter notebook中显示字体如何调整? - 知乎

Python Jupyter Notebook显示行号_AmyFlower6672的博客-CSDN博客

打造实用的Jupyter Notebook 扩展插件 - 知乎

注:本文转载自blog.csdn.net的呆呆象呆呆的文章"https://blog.csdn.net/qq_41554005/article/details/109776371"。版权归原作者所有,此博客不拥有其著作权,亦不承担相应法律责任。如有侵权,请联系我们删除。
复制链接
复制链接
相关推荐
发表评论
登录后才能发表评论和回复 注册

/ 登录

评论记录:

未查询到任何数据!
回复评论:

分类栏目

后端 (14832) 前端 (14280) 移动开发 (3760) 编程语言 (3851) Java (3904) Python (3298) 人工智能 (10119) AIGC (2810) 大数据 (3499) 数据库 (3945) 数据结构与算法 (3757) 音视频 (2669) 云原生 (3145) 云平台 (2965) 前沿技术 (2993) 开源 (2160) 小程序 (2860) 运维 (2533) 服务器 (2698) 操作系统 (2325) 硬件开发 (2491) 嵌入式 (2955) 微软技术 (2769) 软件工程 (2056) 测试 (2865) 网络空间安全 (2948) 网络与通信 (2797) 用户体验设计 (2592) 学习和成长 (2593) 搜索 (2744) 开发工具 (7108) 游戏 (2829) HarmonyOS (2935) 区块链 (2782) 数学 (3112) 3C硬件 (2759) 资讯 (2909) Android (4709) iOS (1850) 代码人生 (3043) 阅读 (2841)

热门文章

101
推荐
关于我们 隐私政策 免责声明 联系我们
Copyright © 2020-2025 蚁人论坛 (iYenn.com) All Rights Reserved.
Scroll to Top