-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Added better support for computing bokeh plot size #1140
Conversation
Ready for review and merge. |
holoviews/plotting/bokeh/renderer.py
Outdated
width, height = plot.plot_width, plot.plot_height | ||
elif isinstance(plot, (Plot, Div, DataTable)): | ||
width, height = plot.width, plot.height | ||
if width is None: width = 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this an error condition? What are you going to do with a plot that is either zero width, zero height or both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certain models do not declare a width/height and rather than guess at it I'd take the hit and just say it's zero. The only thing that I've found that's actually affected by this is the Div
model used to add titles to grid plots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I'll just add an explicit branch for the Div model, and make a comment about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps I'll just add an explicit branch for the Div model, and make a comment about this.
Sounds like a good idea.
I made one comment (although I can't say I follow all the detailed size computation logic!) but generally it looks good. The main thing I checked was that Happy to merge once you address my comment. |
9eb240d
to
b594244
Compare
@jlstevens Ready to merge. |
Looks good. Merging. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
The current
BokehRenderer.get_size
method only supports very simple plots that are not part of a layout grid, or contain toolbars and tables. This PR computes the size of a bokeh plot more accurately for all these cases, which can be very useful when wanting to embed the plot in HTML and know the size ahead of time.