Python ggplot and ggplotly

女生的网名这么多〃 提交于 2019-12-23 13:04:30

问题


Former R user, I used to combine extensively ggplot and plot_ly libraries via the ggplotly() function to display data.

Newly arrived in Python, I see that the ggplot library is available, but cant find anything on a simple combination with plotly for graphical reactive displays.

What I would look for is something like :

from ggplot import*
import numpy as np
import pandas as pd

a = pd.DataFrame({'grid': np.arange(-4, 4),
                 'test_data': np.random.random_integers(0, 10,8)})
p2 = ggplot(a, aes(x = 'grid', y = 'test_data'))+geom_line()
p2
ggplotly(p2)

Where the last line would launch a classic plotly dynamic viewer with all the great functionalities of mouse graphical interactions, curves selections and so on...

Thanks for your help :),

Guillaume


回答1:


You don't need ggplotly in python if all you are seeking is an interactive interface. ggplot (or at least plotnine, which is the implementation that I am using) uses matplotlib which is already interactive, unlike the R ggplot2 package that requires plotly on top.



来源:https://stackoverflow.com/questions/50587634/python-ggplot-and-ggplotly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!