Skip to content

Bug using the underscore notation for annotation attributes, coupled with buttons #4007

@sde-cdsp

Description

@sde-cdsp

Hi, I just had trouble with the following example:

fig.update_layout(
            updatemenus=[
                dict(
                    type="buttons",
                    buttons=[
                        dict(
                            label="All",
                            method="update",
                            args=[
                                {"visible": [True] * 9},  # show all traces
                                {
                                    "annotations": [inner_annotation]
                                },
                            ],
                        ),
                    ],
                )
            ]
        )

Everything works fine on the figure load, however, clicking on the button would change the font_size of my annotation back to default, whereas I set it on 16.

inner_annotation = dict(
            ...
           font_size=16,
        )

After some tests I figured out changing the syntax to

inner_annotation = dict(
            ...
           font={"size": 16},
        )

resolved the issue.

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