Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

full_figure_for_development giving different margins in 6.3 than in 6.2 #7632

Open
@my-tien

Description

@my-tien

I noticed thatfull_figure_for_development gives different margins in plotly.py 6.2 and 6.3, probably because of the plotly.js version bump from 3.0.1 to 3.1.0. Can this be considered a bug? In our use case, we read and use these values to updatefigure.layout.height, because we want to ensure a fixed height of the plot area.

Consider this plotly.py code:

import plotly.graph_objects as gofigure_dict = {  "data": [    {      "x": ["A", "B", "C", "D"],      "y": [100, 200, 150, 300],      "type": "bar"    }  ],  "layout": {    "margin": {      "b": 40,      "l": 0,      "r": 0,      "t": 0    },    "yaxis": {      "tickfont": {        "size": 19      },      "ticklabelposition": "inside top",      "ticklen": 10    }  }}figure = go.Figure(data=figure_dict["data"], layout=figure_dict["layout"])fffd = figure.full_figure_for_development()print(fffd.layout.computed["margin"])

Output for 6.2.0:

{'b': 105, 'l': 0, 'r': 0, 't': 4}

Output for 6.3.0:

{'b': 105, 'l': 0, 'r': 0, 't': 0}

With this second example, alsomargin.b differs:

import plotly.graph_objects as gofigure_dict = {    "data": [        {            "x": [                "A",                "B",                "C",                "D"            ],            "y": [                100,                200,                150,                190            ],            "type": "bar"        }    ],    "layout": {        "yaxis": {            "automargin": "height",            "ticklabelposition": "inside top",            "insiderange": [                0,                250            ]        },        "autosize": True,        "legend": {            "orientation": "v",            "x": 0.05,            "y": -0.1,            "yanchor": "top"        },        "margin": {            "autoexpand": True,            "b": 40,            "l": 0,            "r": 0,            "t": 0        },        "showlegend": True    }}figure = go.Figure(data=figure_dict["data"], layout=figure_dict["layout"])fffd = figure.full_figure_for_development()print(fffd.layout.computed["margin"])

Output for 6.2.0:

{'b': 70, 'l': 0, 'r': 0, 't': 17}

Output for 6.3.0:

{'b': 72, 'l': 0, 'r': 0, 't': 0}

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


      [8]ページ先頭

      ©2009-2025 Movatter.jp