plotly / plotly/plotly.py

Adding date in subplots is slow

Open
#3,869 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3 performance
Dominant language
Python
Stars
18.8k
Forks
2.8k
Avg merge
16h 26m
Merged PRs (30d)
21

Description

Hi everyone!

I'm currently trying to create 50 subplots which will update each second like real time. I don't use dash because visualizing with Jupiter is more important for me.

Well, here is an example of a pseudocode

rows = 50
fig = go.FigureWidget(make_subplots(rows = rows,  cols = 1, vertical_spacing = 0.005))
for i in range(1,rows+1):
        fig.add_trace(go.Scatter(line_color = ...), row = i, col=1)

After, I update my subplots by signals. I decimated date and added in fig

with fig.batch_update():
        for j in range(rows):
            fig.data[j].x = trace['Date'][START:END]      
            fig.data[j].y = trace.iloc[START:END, col_st:col_end][str(col_end)]

And this procedure takes 3 seconds each loop, which is a very long time for my tasks. My question is how I can add more faster date.

If anyone wants to repeat the code, create date with size 100 and add to each subplots.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides pseudocode using FigureWidget, make_subplots, and batch_update, but names no repository files or tests. Start by reproducing 50 subplots with 100-point date arrays and profiling the update loop. Done would require a confirmed performance improvement or a documented explanation of the limiting path.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
data-visualization, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.