You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Kaleido ignores width/height from Plotly figure #12
First of all, thanks for the great work on the Kaleido package -- great improvement over Orca architecture!
However, the width and height attributes as set in a Figure layout are ignored: you have to specify them explicitly in the write_image command. This is not required when using Orca. It would be very nice to have this feature also for Kaleido.
Hi @kvanderwijst, thanks for the encouraging words and for giving Kaleido a try!
I can confirm what you're seeing and this is definitely an oversight. Until we get a fix out, you can work around this by setting the default width/height to None like this:
For width, we should check the figure's layout.width and layout.template.layout.width properties before falling back to self.default_width. Same for height.
In the meantime, this can be worked around this by setting the default width/height to None like this:
In this case, the figure's width and height will be used if they are available, otherwise the are chosen using the defaults defined in the JavaScript layer here:
Activity
jonmmease commentedon Jul 17, 2020
Hi @kvanderwijst, thanks for the encouraging words and for giving Kaleido a try!
I can confirm what you're seeing and this is definitely an oversight. Until we get a fix out, you can work around this by setting the default width/height to
Nonelike this:Technical details:
The culprits are these lines:
https://github.com/plotly/Kaleido/blob/798fa989c594d370b4b2956a6579fe9c5e74dfae/repos/kaleido/py/kaleido/scopes/plotly.py#L71-L72
For
width, we should check the figure'slayout.widthandlayout.template.layout.widthproperties before falling back toself.default_width. Same for height.In the meantime, this can be worked around this by setting the default width/height to
Nonelike this:In this case, the figure's width and height will be used if they are available, otherwise the are chosen using the defaults defined in the JavaScript layer here:
https://github.com/plotly/Kaleido/blob/798fa989c594d370b4b2956a6579fe9c5e74dfae/repos/kaleido/js/src/plotly/constants.js#L22-L27
Note: This issue only affects the Python Plotly scope, other wrappers of the Kaleido C++ core do not have this problem.
nicolaskruchten commentedon Jul 17, 2020
Interestingly, Orca also ignores the built-in height and width when using it with
fig.show("png")for example. Would be great to get a fix for both.nicolaskruchten commentedon Jul 17, 2020
(both renderers and writers I mean... fixing Orca in post-4.9 doesn't make much sense)
jonmmease commentedon Jul 17, 2020
This is probably a change we'll need to make in the plotly.py renderer code since they also have default width/height logic.
nicolaskruchten commentedon Jul 17, 2020
OK, let's pursue here: plotly/plotly.py#2651
fix height/width
fix height/width
fix height/width
Polish active-contributors-over-time histogram (#14)
Polish active-contributors-over-time histogram (#14)