gpt4 book ai didi

vaex - 如何在 Vaex 中进行交互式二维散点图缩放/点选择?

转载 作者:行者123 更新时间:2023-12-04 02:45:45 27 4
gpt4 key购买 nike

我在演示中看到可以这样做:https://youtu.be/2Tt0i823-ec?t=769

在那里,演示者有一个巨大的数据集,可以通过用鼠标选择一个矩形来快速放大。

我还看到了教程的“交互式小部件”部分:https://docs.vaex.io/en/latest/tutorial.html#Interactive-widgets

但是,我无法轻松复制该设置。实现它的最少步骤是什么?

在 Ubuntu 19.04 vaex 2.0.2 上,我试过:

python3 -m pip install --user vaex scipy pandas vaex-jupyter
jupyter nbextension enable --py widgetsnbextension
jupyter nbextension enable --py bqplot
jupyter nbextension enable --py ipyvolume
jupyter nbextension enable --py ipympl
jupyter nbextension enable --py ipyleaflet
jupyter nbextension enable --py ipyvuetify
jupyter notebook

然后我创建了一个notebook,并在notebook中粘贴:

import vaex
import vaex.jupyter
import numpy as np
import pylab as plt
%matplotlib inline
df = vaex.example()
df.plot_widget(df.x, df.y, f='log1p', backend='bqplot')

但我得到的只是没有图表和消息:

Plot2dDefault(w=None, what='count(*)', x='x', y='y', z=None)

如果我这样做:

df.plot(df.x, df.y, f='log1p')

然后我确实得到了一个情节,但它只是一个非交互式图像。

我还尝试 git clone 作为阅读文档页面来源的笔记本:https://github.com/vaexio/vaex/blob/0247f0673c5c0473001b0b66adcbc716560536aa/docs/source/tutorial.ipynb但结果是一样的。

我的动机是找到一个可以处理大量点的绘图程序,如以下所述:Large plot: ~20 million samples, gigabytes of data

最佳答案

使用virtualenv

不知道为什么,但这解决了它。我认为这是因为 Jupyter 可执行文件在 Python 2 上,找不到 Python 3 扩展。

virtualenv --python=python3 .venv
. .venv/bin/activate
python3 -m pip install vaex scipy pandas vaex-jupyter
jupyter nbextension enable --py widgetsnbextension
jupyter nbextension enable --py bqplot
jupyter nbextension enable --py ipyvolume
jupyter nbextension enable --py ipympl
jupyter nbextension enable --py ipyleaflet
jupyter nbextension enable --py ipyvuetify
jupyter notebook

在新笔记本中:

import vaex
df = vaex.example()
df.plot_widget(df.x, df.y, f='log1p', backend='bqplot')

现在我看到了带有缩放功能的交互式小部件!

enter image description here

版本:

pandas==0.25.0
scipy==1.3.0
vaex==2.0.2
vaex-jupyter==0.3.0

关于vaex - 如何在 Vaex 中进行交互式二维散点图缩放/点选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57323126/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com