JupyterLab - Vega 2和Vega-Lite 1 MIME渲染扩展
项目描述
jupyterlab-vega2
JupyterLab的扩展,用于渲染Vega 2和Vega-lite 1。
Vega 2已弃用。最新版本默认包含在JupyterLab中。只有当您有无法与最新版本一起工作的规范时,才使用此扩展。
需求
- JupyterLab >= 3.0
安装
pip install jupyterlab-vega2
用法
在IPython中渲染Vega 2或Vega-lite 1输出
from IPython.display import display
display({
"application/vnd.vegalite.v1+json": {
"$schema": "https://vega.github.io/schema/vega-lite/v1.json",
"description": "A simple bar chart with embedded data.",
"data": {
"values": [
{"a": "A", "b": 28}, {"a": "B", "b": 55}, {"a": "C", "b": 43},
{"a": "D", "b": 91}, {"a": "E", "b": 81}, {"a": "F", "b": 53},
{"a": "G", "b": 19}, {"a": "H", "b": 87}, {"a": "I", "b": 52}
]
},
"mark": "bar",
"encoding": {
"x": {"field": "a", "type": "ordinal"},
"y": {"field": "b", "type": "quantitative"}
}
}
}, raw=True)
要渲染.vg
、.vl
、.vg.json
、.vl.json
文件,只需打开它。
贡献
开发安装
注意:您需要NodeJS来构建扩展包。
jlpm
命令是JupyterLab的固定版本yarn,它是与JupyterLab一起安装的。您可以使用下面的yarn
或npm
代替jlpm
。
# Clone the repo to your local environment
# Change directory to the jupyterlab-vega2 directory
# Install package in development mode
pip install -e .
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Rebuild extension Typescript source after making changes
jlpm run build
您可以在不同的终端中同时监视源目录并运行JupyterLab,以监视扩展源的变化并自动重新构建扩展。
# Watch the source directory in one terminal, automatically rebuilding when needed
jlpm run watch
# Run JupyterLab in another terminal
jupyter lab
在运行监视命令时,每次保存的更改都会立即在本地构建并可用于您正在运行的JupyterLab。刷新JupyterLab以在浏览器中加载更改(您可能需要等待几秒钟以重新构建扩展)。
默认情况下,jlpm run build
命令为此扩展生成源映射,以便更容易使用浏览器开发者工具进行调试。要为JupyterLab核心扩展也生成源映射,您可以运行以下命令
jupyter lab build --minimize=False
卸载
pip uninstall jupyterlab-vega2
项目详情
下载文件
下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源分布
jupyterlab-vega2-3.2.0.tar.gz (280.6 kB 查看哈希值)
构建分布
jupyterlab_vega2-3.2.0-py3-none-any.whl (553.1 kB 查看哈希值)
关闭
jupyterlab-vega2-3.2.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | b96a6bd75c74c1ffbfef499d127b1b23ea7e8c0a2d58355eebd71dd474ca8a17 |
|
MD5 | d75ce7beac5b8da7e62d452e34c446c4 |
|
BLAKE2b-256 | 62a762ca83f860da085a8944e8bcfc581ff22158eedd685792caeb62c7e549ce |
关闭
jupyterlab_vega2-3.2.0-py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | dbd91a89b8e553f41f97954068c8a28c40c50eef5050ae70e8dad375d20fe8e9 |
|
MD5 | f3692afc0b3b9243bf9b54649714fac0 |
|
BLAKE2b-256 | 0e93cdf28cf08f6728acba844ade4b0c78a08bbffdb33da32b7f7552796baa21 |