Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Adding N annotations takes O(N^2) time #5316

Copy link
Copy link

Description

@amari-ca
Issue body actions

Plotly is unreasonably slow to add more than a few hundred annotations to a plot. This code

import time

import plotly


fig = plotly.graph_objects.Figure()

NUM_ANNOTATIONS=1000

start_time = time.monotonic()
for i in range(NUM_ANNOTATIONS):
    fig.add_annotation(
        x=i,
        y=time.monotonic() - start_time,
        text=str(i),
    )
    print(i)
fig.update_layout(
    xaxis_range=[0,NUM_ANNOTATIONS],
    yaxis_range=[0,time.monotonic() - start_time],
    xaxis_title_text="# Annotations",
    yaxis_title_text="Cumulative Time [s]",
)
fig.show()

produces this plot

Image
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2considered for next cycleconsidered for next cyclebugsomething brokensomething brokenperformancesomething is slowsomething is slow

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.