Jupyter 中的交互式绘图

数据挖掘 Python 可视化 朱庇特 蟒蛇
2022-03-10 06:50:34

我正在寻找 Jupyter 扩展来绘制交互式图表。例如,我需要绘制二十条时间序列线以检查数据。我发现的唯一插件是 bqplot https://github.com/bloomberg/bqplot但它的文档太复杂了。

你能建议一些其他免费工具或帮助 bqplot 吗?

我无法绘制不同颜色的线条。

unitIds = commonSeries['UnitId'].unique()
commonSeries = commonSeries.sort_values(by=['Date','UnitId'], ascending=True)
commonSeries = commonSeries.set_index(pd.DatetimeIndex(commonSeries['Date']))

plt.clear()
x_ord = OrdinalScale()
y_sc = LinearScale()
lines = []

for unitId in unitIds:    
    timeseries = commonSeries.loc[commonSeries['UnitId'] == unitId]
    line = plt.Lines(x=timeseries.index, y=timeseries['Value'], scales={'x': x_ord, 'y': y_sc}, colors=['red','green','blue'])
    lines.append(line)

plt.Figure(marks=lines) 

在此处输入图像描述

4个回答

Plotly是迄今为止我用过的最好的交互式可视化库/平台,它也可以很好地与 IPython/Jupyter 配合使用。

Plotly 的文档中有一些教程可以帮助您将它与 Jupyter 集成。另一个教程

我发现了简单、有用且开源的插件:http ://holoviews.org

BokehPlotly都具有交互式可视化功能,可以在 Jupyter 笔记本中使用。