pythonic生物人

bqplot:又一个Python交互可视化工具!

本次分享Python bqplot

Image

我的学习小圈子👉
加入

本文分享一个Python交互式可视化工具bqplot,bqplot是为Jupyter Notebook开发的一个交互插件,使用图层图形语法 (the Grammar of Graphics,了解该语法👉图层图形语法详解) ,但是丰富了交互图层,可满足丰富的交互式可视化需求,比如,

Image
神经网络交互可视化
Image
时间序列交互可视化

此外,在基础图形可视化上,bqplot功能也很强大,拥有类似matplotlib.pyplot的bqplot.pyplot。


安装

pip install bqplot
jupyter nbextension enable --py --sys-prefix bqplot

安装成功后,在Jupyter Notebook主页会出现👇 Image


快速使用

bqplot有两种实现可视化的方式

  • 面向对象方法: 使用图层图形语法 (the Grammar of Graphics) ,可满足更多个性化需求;
  • pyplot方法: 即bqplot.pyplot,类似matplotlib.pyplot;Image下面简单列举两个例子,

非交互图形

主要使用bqplot.pyplot实现,以bqplot.pyplot.hist为例,

import numpy as np
import bqplot.pyplot as plt

fig = plt.figure(title='Histogram by bqplot')
hist = plt.hist(sample=np.random.randn(100), bins=10, colors=['#01a2d9'])
fig

Image

交互图形

在图形中实现平移、缩放、选择等交互功能,

Image
气泡图交互可视化

更多移步:https://github.com/bqplot/bqplot


-END-

Image

我的学习小圈子👉
加入

点个 在看就是最大的支持Image