-
-
Notifications
You must be signed in to change notification settings - Fork 409
Description
Hi,
first, thanks for providing an awesome library.
It seems the export feature using hv.save seems broken, though I'm not sure whether this is a holoviews or bokeh issue.
ALL software version info
bokeh 2.1.0
chromedriver 2.24.1
jupyterlab 2.1.4
numpy 1.18.5
pandas 1.0.4
panel 0.9.5
Pillow 7.1.2
selenium 3.141.0
python 3.7.4
macos 10.15.5
chrome 83
Description of expected behavior and the observed behavior
When plotting data from a number of dataframes and exporting them to .png files, I noticed that the margin at the sides of the plot is increasing every time a new plot is exported. See a simplified example below.
Observations, some might not be directly related:
- This seems only to happen with datashader=True
- The last time I remember this working was beginning of this year. I do not know which libraries I updated since then, sorry.
- Currently, hv.save() quietly saves as .html even with extension .png both in the path and in
fmt='png'defined; this might be related to PR Fix hv.save for png images #4304 though I'm not sure - Also noticed that the version using the
hv.Store.rendererswas quietly saving as html when chromedriver was not installed - not sure if I should file this as an issue? - When trying to figure out which option will size the plot when exported to png (something I still don't fully understand), I noticed a mention (here) that the canvas for gridplots changed sometime around boke 2.0 - these threads are on the bokeh export_png function
- I did try inserting
hv.output(size=200)in the loop to reset the plot sizing, but that does not affect the outcome - So far the only way I found to reset the margins/sizing was to restart the notebook kernel
Complete, minimal, self-contained example code that reproduces the issue
import numpy as np
import pandas as pd
from time import time
import holoviews as hv
import datashader as ds
import hvplot.pandas
from holoviews.operation.datashader import datashade, dynspread
df = pd.DataFrame()
df['x'] = np.arange(100)
df['y'] = np.random.rand(len(df.x))
df['c1'] = df.x // 10
df['c1'] = df.x // 50
for i in range(9):
plot = df.hvplot(x='x', y='y', row='c1', datashade=True, dynspread=True).opts(toolbar=None)
renderer = hv.Store.renderers['bokeh'].instance(fig='png', holomap='widgets')
renderer.save(plot, f'plot{i}.png')
# hv.save(plot, f'plot_save_{i}.png', fmt='png') # currently ouputs .html w/o warning
Screenshots or screencasts of the bug in action
First and last plot result from that loop:

plot when not using datashader, does not change during loop:

