一、单元格宽度

这个命令:

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 (usually cmd+r or ctrl+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)的更多相关文章

  1. firefox ie chrome 设置单元格宽度 td width 有bug,不能正常工作。以下方式可以解决

    1. firefox ie chrome 设置单元格宽度 td width 有bug,不能正常工作. 如果是上面一行 和下面一行是分别属于两个table,但是他们的列需要对齐,也就是说分开画的,然后设 ...

  2. 关于html表格单元格宽度的计算规则

    * { margin: 0; padding: 0 } body { background: #fafafa } ul,li { list-style: none } h1 { margin: 20p ...

  3. Easyui datagrid 设置内容超过单元格宽度时自动换行显示

    datagrid 设置内容超过单元格宽度时自动换行显示 by:授客 QQ:1033553122 测试环境 jquery-easyui-1.5.3 问题描述 单元格内容超过单元格宽度不会自动化换行.如下 ...

  4. colgroup中col定义表格单元格宽度

    colgroup中可以使用col来定义表格单元格宽度,可以使用像素(数字),百分比,我们来具体看看有什么不同. 先看一个最基本的:用像素(数字)表示,因为table有个宽度,这里表示占比 <ht ...

  5. CSS开发技巧(二):表格合并边框后的单元格宽度计算

    前言: 分离边框模型和合并边框模型是表格的两种模型,它通过以下属性确定: border-collapse:separate(默认值) | collapse | inherit 当采用分离边框模型时,表 ...

  6. 读取Excel文件中的单元格的内容和颜色

    怎样读取Excel文件中的单元格的内容和颜色 先创建一个Excel文件,在A1和A2中随意输入内容,设置A1的字体颜色为红色,A2的背景为黄色.需要 using Excel = Microsoft.O ...

  7. mac下更改Jupyter notebook工作目录

    Jupyter notebook运行之后,默认的工作目录在mac下是个人文件夹,在windows下貌似也是如此.显然不太合理,需要修改它. 具体办法是: 进入终端命令行模式,输入下面的代码: jupy ...

  8. 【python】windows更改jupyter notebook(ipython)的默认打开工作路径

    写在前面:本博客为本人原创,严禁任何形式的转载!本博客只允许放在博客园(.cnblogs.com),如果您在其他网站看到这篇博文,请通过下面这个唯一的合法链接转到原文! 本博客全网唯一合法URL:ht ...

  9. windows更改Jupyter Notebook工作的目录

    1.将打开的Jupyter Notebook程序关闭,然后找到桌面快捷方式,右键=>属性,然后把目标后面输入框最后的“%USERPROFILE%”这个参数去掉后,确定.否则之后做的其它修改无法生 ...

随机推荐

  1. 路由 router-view

    路由,其实就是指向的意思,当我点击页面上的home按钮时,页面中就要显示home的内容,如果点击页面上的about 按钮,页面中就要显示about 的内容.Home按钮 => home 内容, ...

  2. java 微信开发的工具类WeChatUtils

    import com.alibaba.fastjson.JSONObject;import com.bhudy.entity.BhudyPlugin;import com.bhudy.service. ...

  3. WUSTOJ 1889: 编辑距离(Java)

    转自:

  4. SysTick 定时实验(中断)

    实验目的:利用 SysTick 产生 1s 的时基,LED 以 1s 的频率闪烁. 编程要点 1.设置重装载寄存器的值 2.清除当前数值寄存器的值 3.配置控制与状态寄存器 过程 我们创建了两个文件: ...

  5. (错误)启动ActiveMQ报错:Transport Connector could not be registered in JMX: java.io.IOException: Failed to bind to server socket: stomp://0.0.0.0:61613?

    一.错误报告 很明显,端口被占用 二.解决方法 1. 在cmd中输入 netstat -ano 查看61613端口被占用情况,如果有其他进程使用,则使用 taskkill /f /pid 进程PID  ...

  6. JS OOP -03 JS类的实现

    JS类的实现: a.理解类的实现机制 b.使用prototype对象定义类成员 c.一种JS类的设计模式 a.理解类的实现机制 在JS中可以使用function关键字来定义一个类. 添加类的成员,在函 ...

  7. sql过程的条件是IN,用脚本执行

    DECLARE @sql nvarchar(); DECLARE @inStr nvarchar(); SET @inStr='''条件1'',''条件2'''; set @sql='SELECT * ...

  8. vue-cli中eslint配置

    在项目目录下找到.eslintrc.js文件,使用编辑器打开进行编辑.在rules下添加space-before-function-paren.space-before-blocks.及semi的配置 ...

  9. 前端开发 Vue -1windows环境搭建Vue Node开发环境

    解决几个疑问: 想学习下vue.js,我理解的它是一个前端的框架,主要作用是对数据的处理,和juqery类似,所以不太理解为什么要在nodejs中npm install vue呢?在html文件中引入 ...

  10. 12.java中参数传递机制---形参和实参

    1.形参:用来接收调用该方法时传递的参数.只有在被调用的时候才分配内存空间,一旦调用结束,就释放内存空间.因此仅仅在方法内有效. public void swap(int a, int b) { in ...