Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rom-burner opened this issue Dec 9, 2020 · 3 comments · Fixed by #76
Closed

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

rom-burner opened this issue Dec 9, 2020 · 3 comments · Fixed by #76
Labels
bug something broken

Comments

@rom-burner
Copy link

rom-burner commented Dec 9, 2020

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?

@jonmmease
Copy link
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

width = width or layout.get("width", None) or self.default_width
height = height or layout.get("height", None) or self.default_height

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

@jonmmease jonmmease added the bug something broken label Dec 9, 2020
@nicolaskruchten
Copy link

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}

@jonmmease
Copy link
Collaborator

Agreed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken
Projects
None yet
3 participants