我是靠谱客的博主 爱笑电源,最近开发中收集的这篇文章主要介绍jupyter notebook / jupyter lab 深色主题下如何设置字体 及 如何设置绘图颜色1. jupyter notebook 深色主题配置1*. jupyter notebook插件安装2. jupyter notebook 绘图颜色设置3. jupyter lab 深色主题配置4. jupyter lab 绘图颜色设置,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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

文章目录

  • 1. jupyter notebook 深色主题配置
  • 1*. jupyter notebook插件安装
  • 2. jupyter notebook 绘图颜色设置
  • 3. jupyter lab 深色主题配置
  • 4. jupyter lab 绘图颜色设置

1. jupyter notebook 深色主题配置

cmdAnaconda Prompt中:

jupyter notebook 安装主题

pip install jupyterthemes

jupyter notebook 更新主题

pip install --upgrade jupyterthemes

查看可用主题

jt -l

暗色背景monokai设置 字体选择 fira 大小选 11 占屏比为90%,输出字段大小为11的设置方法

jt -t monokai -f fira -fs 11 -cellw 90% -ofs 11 -dfs 11 -T -N

参数解释:

  • f(字体)
  • fs(字体大小)
  • cellw(占屏比或宽度)
  • ofs(输出段的字号)
  • T(显示工具栏)
  • N(显示自己主机名)

还有ocean16背景的设置方法:

jt -t oceans16 -f fira -fs 11 -cellw 90% -ofs 11 -dfs 11 -T

1*. jupyter notebook插件安装

jupyter notebook的插件功能非常强大,所以在设置背景的同时,也需要进行插件安装。
首先安装nbextensions:

pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user

然后安装 nbextensions_configurator:

pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user

在这种情况下,notebook主页上就会出现nbextensions的选项卡,可以在该选项卡下配置诸多的插件。

此处如果总是出现类似

Config option `template_path` not recognized by `LenvsLatexExporter`

的错误,则需要通过以下方式解决

conda install "nbconvert=5.6.1"

原因是nbconvert6.0.0版本以上的某些参数的名称发生了更改,与原先版本不兼容,需要将版本降低到5.6.1
解决方案的参考链接

2. jupyter notebook 绘图颜色设置

深色背景下,jupyter notebook采用matplotlib工具绘图时,坐标轴通常会因对比度的原因,非常难以识别。
在jupyterthemes下有jtplot包,可以选择一个绘图主题来进行绘制。

from jupyterthemes import jtplot
jtplot.style(theme='onedork') #选择一个绘图主题

参考链接-感谢前人栽树

3. jupyter lab 深色主题配置

关于深色主题的配置,可以参考本人以下文章(第6节):
Jupyterlab安装踩坑

jupyter lab还包含有字体插件,可以像其他IDE一样在相关的字体选项列表里对字体进行设置。

4. jupyter lab 绘图颜色设置

和jupyter notebook的处理方法一致。

最后

以上就是爱笑电源为你收集整理的jupyter notebook / jupyter lab 深色主题下如何设置字体 及 如何设置绘图颜色1. jupyter notebook 深色主题配置1*. jupyter notebook插件安装2. jupyter notebook 绘图颜色设置3. jupyter lab 深色主题配置4. jupyter lab 绘图颜色设置的全部内容,希望文章能够帮你解决jupyter notebook / jupyter lab 深色主题下如何设置字体 及 如何设置绘图颜色1. jupyter notebook 深色主题配置1*. jupyter notebook插件安装2. jupyter notebook 绘图颜色设置3. jupyter lab 深色主题配置4. jupyter lab 绘图颜色设置所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部