Skip to content

Support dict union operator in legend updates #4046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
janosh opened this issue Jan 30, 2023 · 1 comment
Open

Support dict union operator in legend updates #4046

janosh opened this issue Jan 30, 2023 · 1 comment
Labels
feature something new P3 backlog

Comments

@janosh
Copy link
Contributor

janosh commented Jan 30, 2023

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.

@nicolaskruchten
Copy link
Contributor

That's a cool idea! We'd surely accept a pull-request for that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 backlog
Projects
None yet
4 participants