X Tutup
The Wayback Machine - https://web.archive.org/web/20250523065821/https://github.com/plotly/plotly.py/issues/3148
Skip to content

Inconsistent title text updates #3148

Closed
@alexcjohnson

Description

@alexcjohnson

Updating a layout with new title text behaves differently whether you use the modern nested title->text form or the old-but-still-supported form of title as a string.

>>> go.Layout(title=dict(font_color="red")).update(title=dict(text="hi"))
Layout({
    'title': {'font': {'color': 'red'}, 'text': 'hi'}
})
>>> go.Layout(title=dict(font_color="red")).update(title="hi")
Layout({
    'title': {'text': 'hi'}
})

Notice how the first one (using title->text) performs a deep merge, so existing title styling is preserved. The second form wipes out the title object, replacing it with just the new string and removing the styling. Ideally both of these should perform a deep merge.

I've seen this issue with other titles too, such as xaxis->title

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup