Skip to content

Static renderers ignore height/width #2651

Closed

Description

@nicolaskruchten

This always renders at the default size for me:

import plotly.express as px
fig = px.scatter(y=[1,2,3], height=300, width=300)
fig.show("png")

I would consider this a bug, although there may be some reasoning behind this behaviour ... @jonmmease ?

Activity

  1. added this to the 4.10 milestone on Jul 17, 2020
  2. jonmmease commented on Jul 17, 2020

    @jonmmease
    Contributor

    Yeah, this behavior is not intuitive. The issue is that the height and width here are overriding the height and width properties of the Image renderer. So this is roughly equivalend to

    import plotly.io as pio
    pio.renderers["png"].height = 300
    pio.renderers["png"].width = 300
    
    import plotly.express as px
    fig = px.scatter(y=[1,2,3])
    fig.show("png")
    

    So here, width and height are really the default width and height. And here I think it makes sense for the figure's own width/height to take precedence.

    But in any case, we do need to put some more thought into precedence.

  3. nicolaskruchten commented on Jul 17, 2020

    @nicolaskruchten
    ContributorAuthor

    Right so this is the same as fig.show("png", width=300, height=300)

  4. nicolaskruchten commented on Jul 17, 2020

    @nicolaskruchten
    ContributorAuthor

    See also #2653

  5. modified the milestones: 4.10, v4.x on Sep 10, 2020
  6. nicolaskruchten commented on Jun 16, 2021

    @nicolaskruchten
    ContributorAuthor

    This is addressed in #3240 and will be part of version 5.0

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions