一、单元格宽度
这个命令:
jt -t gruvboxl -f roboto -fs 12 -cellw 100% -T -N
它将宽度设置为100%
二、主题颜色
在用jupyter notebook时,想到一个问题,能不能更改jupyter notebook的主题颜色,总是看着白色的默认主题,有些乏味,也不够酷炫。博主找到了让jupyter notebook变得酷炫的方法。
默认的样式:
使用之后:
除此之外,在pycharm中的jupyter
notebook,颜色上也有一些问题。我不知道是特例还是普遍现象,在pycharm中,jupyter
notebook的背景颜色很多时候不能根据IDE的主题来一起更改,很多时候会出现下图所示情况。也可以通过这种方法来解决。
使用的是jupyter-themes,下面介绍用法:
首先在控制台下用pip 安装jupyter-themes
pip install --upgrade jupyterthemes
- 1
- 1
然后可以查看所有可用的主题:
usename$ jt -l
Available Themes:
chesterish
grade3
monokai
oceans16
onedork
solarizedd
solarizedl
三、作者github的方法介绍
Links
Requirements
- Python 2.7, 3.4, 3.5, 3.6
- Jupyter (Anaconda recommended)
- matplotlib
Install with pip
# install jupyterthemes
pip install jupyterthemes # upgrade to latest version
pip install --upgrade jupyterthemes
Known issues
-
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 (usuallycmd+r
orctrl+r
). -
install issue: if you get an error saying
jt
is not recognized, try this fix. - slow render when scrolling: fix available here
-
for best results: use notebook>=5.0 (
pip install --upgrade notebook
)
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 |
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 notebook的单元格宽度和主题颜色(theme)的更多相关文章
-
firefox ie chrome 设置单元格宽度 td width 有bug,不能正常工作。以下方式可以解决
1. firefox ie chrome 设置单元格宽度 td width 有bug,不能正常工作. 如果是上面一行 和下面一行是分别属于两个table,但是他们的列需要对齐,也就是说分开画的,然后设 ...
-
关于html表格单元格宽度的计算规则
* { margin: 0; padding: 0 } body { background: #fafafa } ul,li { list-style: none } h1 { margin: 20p ...
-
Easyui datagrid 设置内容超过单元格宽度时自动换行显示
datagrid 设置内容超过单元格宽度时自动换行显示 by:授客 QQ:1033553122 测试环境 jquery-easyui-1.5.3 问题描述 单元格内容超过单元格宽度不会自动化换行.如下 ...
-
colgroup中col定义表格单元格宽度
colgroup中可以使用col来定义表格单元格宽度,可以使用像素(数字),百分比,我们来具体看看有什么不同. 先看一个最基本的:用像素(数字)表示,因为table有个宽度,这里表示占比 <ht ...
-
CSS开发技巧(二):表格合并边框后的单元格宽度计算
前言: 分离边框模型和合并边框模型是表格的两种模型,它通过以下属性确定: border-collapse:separate(默认值) | collapse | inherit 当采用分离边框模型时,表 ...
-
读取Excel文件中的单元格的内容和颜色
怎样读取Excel文件中的单元格的内容和颜色 先创建一个Excel文件,在A1和A2中随意输入内容,设置A1的字体颜色为红色,A2的背景为黄色.需要 using Excel = Microsoft.O ...
-
mac下更改Jupyter notebook工作目录
Jupyter notebook运行之后,默认的工作目录在mac下是个人文件夹,在windows下貌似也是如此.显然不太合理,需要修改它. 具体办法是: 进入终端命令行模式,输入下面的代码: jupy ...
-
【python】windows更改jupyter notebook(ipython)的默认打开工作路径
写在前面:本博客为本人原创,严禁任何形式的转载!本博客只允许放在博客园(.cnblogs.com),如果您在其他网站看到这篇博文,请通过下面这个唯一的合法链接转到原文! 本博客全网唯一合法URL:ht ...
-
windows更改Jupyter Notebook工作的目录
1.将打开的Jupyter Notebook程序关闭,然后找到桌面快捷方式,右键=>属性,然后把目标后面输入框最后的“%USERPROFILE%”这个参数去掉后,确定.否则之后做的其它修改无法生 ...
随机推荐
-
Oracle RAC 更换存储实验
实验环境准备: RHEL 6.5 + Oracle 11.2.0.4 RAC (2nodes) OCR和Voting Disk使用的是OCR1磁盘组,底层对应3个1G大小的共享LUN,一般冗余: DA ...
-
js+JQuery实现返回顶部功能
很多网站上都有返回顶部的效果,本文阐述如何使用jquery实现返回顶部按钮. 首先需要在顶部添加如下html元素: <p id="back-to-top"><a ...
-
专题:『Channel Bonding/team』——EXPERIMANTAL!!!
Linux内核支持的多网卡聚合方法——bond.team bond 优点:经过长时间的实践检验,具有较高的稳定性:kernel-2.4及以上内核均广泛支持 缺点:需要通过sysfs或发行版定制的网卡配 ...
-
Android输入输出系统之TouchEvent流程
一个是InputReader,一个是InputDispatcher.方法是dispatchTouch. 入口点是InputReader 的loopOnce方法. InputReader里面有个线程叫做 ...
-
QT第四天学习
回顾: 1.信号与槽 public slots: //先声明后实现 signals: //只需要声明 connect(sender,SIGNAL(signal()),receiver,SLOT(slo ...
-
mysql的学习笔记(九)
mysql不支持FULL JOIN时可用UNION ALL代替 SELECT t1.user_id,t2.user_name FROM t1 LIFT JOIN t2 ON t1.user_id = ...
-
C++ STL库的总结以及实现原理
STL的容器可以分为以下几个大类:一:序列容器, 有vector, list, deque, string. 二 : 关联容器, 有set, multiset, map, mulmap has ...
-
一、kubeadm安装
一.官网 https://kubernetes.io/zh/docs/setup/independent/install-kubeadm/ 阿里云 kubernetes yum 仓库镜像 安装kube ...
-
module_loader.py
# few functions that make it possible to import functions # from jupyter notebooks as from modules; ...
-
delimiter 与 存储过程
1.如此执行语句不行,需要在 delimiter IF not EXISTS ( SELECT * FROM information_schema. COLUMNS WHERE table_schem ...