import hvplot.pandas # must be the first import (in this notebook)
import pandas
pandas.options.plotting.backend = 'hvplot' #same exception if "holoviews"
df = ...
df.plot(rasterize=True) #same if df.hvplot(rasterize=True)
Traceback (most recent call last):
File "/home/toaster/mambaforge-pypy3/envs/puma-lab/lib/python3.8/site-packages/pyviz_comms/__init__.py", line 346, in _handle_msg
self._on_msg(msg)
File "/home/toaster/mambaforge-pypy3/envs/puma-lab/lib/python3.8/site-packages/panel/viewable.py", line 294, in _on_msg
doc.unhold()
File "/home/toaster/mambaforge-pypy3/envs/puma-lab/lib/python3.8/site-packages/bokeh/document/document.py", line 799, in unhold
self.callbacks.unhold()
File "/home/toaster/mambaforge-pypy3/envs/puma-lab/lib/python3.8/site-packages/bokeh/document/callbacks.py", line 396, in unhold
self.trigger_on_change(event)
File "/home/toaster/mambaforge-pypy3/envs/puma-lab/lib/python3.8/site-packages/bokeh/document/callbacks.py", line 373, in trigger_on_change
invoke_with_curdoc(doc, event.callback_invoker)
File "/home/toaster/mambaforge-pypy3/envs/puma-lab/lib/python3.8/site-packages/bokeh/document/callbacks.py", line 408, in invoke_with_curdoc
return f()
File "/home/toaster/mambaforge-pypy3/envs/puma-lab/lib/python3.8/site-packages/bokeh/util/callback_manager.py", line 191, in invoke
callback(attr, old, new)
File "/home/toaster/mambaforge-pypy3/envs/puma-lab/lib/python3.8/site-packages/holoviews/plotting/bokeh/callbacks.py", line 360, in <lambda>
asyncio.create_task(self.on_change(attr, old, new))
File "/home/toaster/mambaforge-pypy3/envs/puma-lab/lib/python3.8/asyncio/tasks.py", line 381, in create_task
loop = events.get_running_loop()
RuntimeError: no running event loop
Works without rasterize=True. Do I need to import anything else or am I using it wrong somehow?
It might be an idea to show full code, make up a dataframe if you can… here’s a poor example but shows you might have to do slighlty different things to get outputs working as expected pending how the dataframe is formed
import hvplot.pandas # must be the first import (in this notebook)
import hvplot
import pandas as pd
import numpy as np
#pandas.options.plotting.backend = 'hvplot' #same exception if "holoviews"
#random timeseries data
date_index = pd.date_range(start='1707-01-01', end='2020-12-31', freq='D')
data = np.random.randint(0, 1450, size=(len(date_index)))
column_names = ['hello']
#create df
df = pd.DataFrame(data,columns=column_names,index=date_index)
df.hvplot() + df.hvplot(x='DateTime',y='hello',rasterize=True)
Thank you for the help @carl !
I’ve run your example and see the same picture. But I also get the exception (with the same traceback) as I report above. The same exception is also thrown every time I resize the second figure.
Hmmn I don’t get this traceback you have. If you work with the virtual environments I’d spin a new one up with just hvplot pandas etc as you may have some incompatibility issue going on with something else…
I just noted looks like your using mamba for installation? I’m sure it works but i did have various issues with it myself on a windows machine so i stuck with mini conda which I had more success with