Feature request: Bypass dataframes
See original GitHub issueThanks for this fantastic package!
I’m wondering if in the spirit of this package being useful for creating exploratory graphs with minimum boilerplate, it makes sense to be able to pass in arrays in lieu of dataframe column names for the plotting function fields.
eg, let
px.scatter(x=[1,2],y=[3,4])
be equivalent to
df=pandas.DataFrame({'x': [1,2], 'y': [3,4]})
px.scatter(df, x='x', y='y')
With the current Plotly API, I think the simplest alternative is
from plotly import graph_objs as go
plot([go.Scatter(x=[1,2],y=[3,4])])
which feels verbose compared to the px
alternative mentioned above and which would require a complete refactor if I decide my data has become rich enough that I want to start using a dataframe-based representation.
As it stands, the necessity of constructing a dataframe can actually make plotly express more vebose than using plotly
directly. It would be great for px
to be the one-shop-stop package for exploratory plotting in Python.
Seaborn, which is stated as an inspiration for this package, does support this syntax for the majority of its plotting functions.
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:7 (5 by maintainers)
Top GitHub Comments
Sure, I can just contribute the PR now so we can play with it - I don’t think it will be too hard. No harm if you don’t end up merging it.
This will be implemented as part of plotly/plotly.py#1767 … thanks for the input and patience 😃