plotly / plotly/plotly.py

Support dict union operator in legend updates

Open
#4,046 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Would be nice if layout.Legend instances supported the dict union operator:

import plotly.graph_objects as go

fig = go.Figure()

fig.layout.legend |= dict(title="")

TypeError: unsupported operand type(s) for |=: 'Legend' and 'dict'

Since legend.update() works in analogy to dict.update()

fig.layout.legend.update(dict(title=""))

>>> layout.Legend({
    'title': {'text': ''}
})

I was expecting other parts of the dict API to work as well.

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

Start at the layout.Legend entry point and inspect how its existing update() behavior relates to dictionary operations. Determine which parts of the dict API are intended to be supported, then verify that the requested union operation and the agreed related operations behave consistently with update().

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.