Skip to content

Plotly express Scatter: slow to setup with animations #2400

Closed
@maartenbreddels

Description

@maartenbreddels

Hi,

I aggregated some data with Vaex, and want to show an animated scatter plot with plotly express. My aggregated dataframe contains 3117 rows (see screenshot), but making the plot takes 11 seconds (on the Python side), which I think is a bit slow.

I've attached a code example below and I've attached the aggregated data, so you don't need to install vaex not download all the data to reproduce it.
taxi.csv.zip

Is this performance expected, and can I do something to work around it? (maybe without plotly express?)

Regards,

Maarten

import pandas as pd
import plotly.express as px

df = pd.read_csv('taxi.csv')
fig = px.scatter(df,
                 x="trip_distance_mean",
                 y="total_amount_mean",
                 color="pickup_borough_name",
                 size='count',
                 hover_data=['pickup_zone_name'],
                 animation_frame="pickup_month", animation_group='pickup_zone_name',
                 range_x=[0, 8], range_y=[0, 30])
fig.show()

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions