Adding N annotations takes O(N^2) time
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- python
- Domain
- data-visualization, performance
Research direction
Start by running the reproduction in the issue and profiling the repeated fig.add_annotation calls. Trace the Python Figure annotation path to identify where the cumulative cost grows, then verify that adding many annotations no longer shows quadratic behavior using the same script.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 13h 41m
- Merged PRs (30d)
- 21
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from plotly/plotly.py
-
P3 size: 1 task
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
P3 size: 1 task
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
bug P1
Difficulty 1/5 Under an hour Newbie friendliness 68/100
-
feature P3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
feature P3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
All issues in plotly/plotly.py
Similar issues
-
Add: hunch Open
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
DiamondLightSource/dodal#2211 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
openml/openml-python#1749 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
sipyourdrink-ltd/bernstein#6191 ·