holoviz / hvplot

A high-level plotting API for pandas, dask, xarray, and networkx built on HoloViews
https://hvplot.holoviz.org
BSD 3-Clause "New" or "Revised" License
1.03k stars 99 forks source link

Hvplot with datashade/rasterize not working neither in Google Colab nor Kaggle #1122

Open yerbby opened 11 months ago

yerbby commented 11 months ago

Previously you were able to run hvplot with full functionality on those platforms just by installing hvplot with:

!pip install hvplot

Since the last mayor version update, to make hvplot work you have to:

!pip install --upgrade hvplot
!pip install --upgrade bokeh
!pip install --upgrade holoviews

However, I have not been able to make it work with datashader/rasterize options, even after installing:

!pip install datashader
!pip install jupyter_bokeh

Reproducible example:

# Load iris dataset
import pandas as pd
from sklearn.datasets import load_iris

iris = load_iris()
df = pd.DataFrame(data=iris.data, columns=iris.feature_names)
df['target'] = iris.target
# this will work: 
import hvplot.pandas

hvplot.extension('bokeh')
df.hvplot(kind='scatter',  x='sepal width (cm)', y='sepal length (cm)', width=600, height=300) 
# this will not work: 
import hvplot.pandas

hvplot.extension('bokeh')
df.hvplot(kind='scatter', 
          x='sepal width (cm)',
          y='sepal length (cm)',
          groupby='target',
          width=600,
          height=300,
          datashade=True, 
        #   rasterize=True,
          cnorm= 'eq_hist', 
          dynspread=True,
          alpha=0.5)

Any hints to make hvplot with datashader work on this online platforms would be welcome. Thanks in advance.

YbY.

jbednar commented 11 months ago

Can you clarify "will not work"? What does it do?

yerbby commented 11 months ago

Sure @jbednar,

in Google Colab executing my previous code will automatically open a Code snippet tab asking for enabling third-party Jupyter widgets, as in the figure below. However, running the suggested two lines of code does not solve the problem and the hvplot is not even shown.

Img1

However, in Kaggle, the plot panel will show up, but the "rasterization" is not working, I mean, if the plot is zoomed or paned it is not renderized again, it is just a static plot, the cloud of dots is not disaggregated when you zoom in, etc.

image

jbednar commented 11 months ago

Ok, thanks for clarifying!

Rridley7 commented 8 months ago

Hello, checking to see whether any updates are available on this issue? Running into the same problem, with colab not showing a plot when rasterize=True.

jmakov commented 6 months ago

Same problem on local instance - zooming doesn't redraw.