plotly / plotly/dash

allow deletion of data from Heat Figs with Patch()

Open
#2,802 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #2837 by @justinzhu17 — closed without merging
feature P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

I am trying to delete some data from a heat fig, and it doesn't seem to be possible with patch. With patch, you would return something like

fig = Patch()
del fig['data'][0][x][0]

to delete the first item in the heatfig. The issue is that the heatfig has the following structure:

{ "data": [
    {
      "x": ["2021-12-21T19:58:00.542000", "2021-12-21T19:58:01.542000", "2021-12-21T19:58:02.542000" ],
      "y": [13500.0, 13503.33591, 13506.67183 ],
      "z": [[599.8054, 581.1404, 570.4771 ],
              [678.9323, 644.2858, 610.9979 ],
              [576.6772, 568.9164, 565.6251 ],
    }]}

and so you would need to loop through each list in the z field to remove the first item as well (as the heatfig is a 3D array). We can't know ahead of time how many items are in the z field making it impossible to delete data.

Basically, if you want to remove the first timestamp in the fig, you would need the data to look like:

{ "data": [
    {
      "x": ["2021-12-21T19:58:01.542000", "2021-12-21T19:58:02.542000" ],
      "y": [13500.0, 13503.33591, 13506.67183 ],
      "z": [[581.1404, 570.4771 ],
              [644.2858, 610.9979 ],
              [568.9164, 565.6251 ],
    }]}

I don't want to load in the whole fig as state because it is quite large (and defeats the purpose of using a Patch()).
I haven't found a work around for this yet.

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

No files or tests are named in the issue. Start by reproducing the Patch() heat-figure example and trace the existing patch behavior for nested x, y, and z data. Done means a timestamp can be removed from the figure, with corresponding z values updated, without loading the entire figure state.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.