Skip to content

Layout properties specified through templates not applied on io.write_image() #62

Closed

Description

@rom-burner

Eg specifying a height and width as properties in a template for a figure and using the show() method renders the figure correctly, but write() method using kaleido defaults to plotly.io.kaleido.scope.default_height and default_width of 500x700, regardless of what is specified in the figure's template. Not tried with orca.

Easy fix is to re-specify figure dimensions again in io.write_image() call, but should this be necessary?

Activity

  1. jonmmease commented on Dec 9, 2020

    @jonmmease
    Collaborator

    Thanks for the report @rom-burner. I talked about checking the template's layout width in #12, but looks like I didn't end up implementing that in #18.

    I think we can handle this here

    https://github.com/plotly/Kaleido/blob/76ff4d3b04d08f90a76a9e11478feeb5c95b0473/repos/kaleido/py/kaleido/scopes/plotly.py#L81-L82

    As a workaround, do you get the template width/height if you set the scope's default_width and default_height to None globally?

    import plotly.io as pio
    pio.kaleido.scope.default_width = None
    pio.kaleido.scope.default_height = None
  2. nicolaskruchten commented on Dec 10, 2020

    @nicolaskruchten

    See also plotly/plotly.py#2651 ... would be nice to just fix this everywhere and have the static renderers always honor layout.{width|height} falling back to layout.template.layout.{width|height}

  3. jonmmease commented on Dec 10, 2020

    @jonmmease
    Collaborator

    Agreed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething broken

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions