-
Notifications
You must be signed in to change notification settings - Fork 12
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
Working with nbagg #47
Comments
It seems as long as sufficient space is allocated at the edges of the plot and the size is correctly specified using nbagg works fine. HoloViews currently sets very tight bounds around the plot and nbagg ends up cutting too much of the plot off because it does not compute a tight bounding box before rendering. Setting a more conservative There's still separate issues with aspects not being taken into account in Layouts but those are general issues to improve Layout support for which we already have extensive discussion in HoloViews. |
consider this as a cube_browser set up option, to explicitly set the bounds to be nb_agg compliant |
As promised, here is a simple pure matplotlib example demonstrating that nbagg cuts things off: import numpy as np
import matplotlib.pyplot as plt
%matplotlib notebook
plt.imshow(np.random.rand(10,10))
plt.colorbar()
ax = plt.gca()
ax.set_yticks([0, 3, 6, 9])
ax.set_yticklabels(['Long', 'Longer', 'Really Long', 'Really Really Long']) and it gets even worse when reducing the margins using: plt.gcf().subplots_adjust(left=0.05, bottom=0.05, right=0.95, top=0.95) The problem here is twofold, first of all there is no way that I'm aware of that allows requesting a tight bounding box. However even if the tight option was supported we would still want to supply an explicit bounding box so that the plot doesn't jump around when animating the frames. |
In the last meeting we got a request to allow the user to work with the matplotlib nbagg backend to enable some of the interactive features that allows. Enabling nbagg in HoloViews is trivial and can be done simply by executing
This works fine for individual figures but because the nbagg backend applies some internal magic to compute the bounding box around all the figure artists, laying out multiple plots will often result in cut off axis labels, colorbars or even parts of the actual plot. I've investigated how to control the bounding box of the rendered figure in the nbagg backend but haven't been able to figure out a solution that actually works. If we do want to commit to using nbagg we'll need to discuss how the bounding box code in nbagg works with someone who is familiar with its internals.
The text was updated successfully, but these errors were encountered: