Skip to content
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

ValueError('y must be real') when plotting by + rasterize on a sparse dataset #1352

Open
ahuang11 opened this issue Jul 9, 2024 · 1 comment

Comments

@ahuang11
Copy link

ahuang11 commented Jul 9, 2024

Not entirely sure if this is datashader or hvplot so feel free to transfer over, but I'd expect this to work.

import hvplot.pandas
from bokeh.sampledata.penguins import data as df

df.hvplot.points(
    x="bill_length_mm",
    y="bill_depth_mm",
    by="species",
    rasterize=True
)
File ~/miniconda3/envs/census/lib/python3.12/site-packages/holoviews/operation/datashader.py:422, in aggregate._apply_datashader(self, dfdata, cvs_fn, agg_fn, agg_kwargs, x, y)
    417 with warnings.catch_warnings():
    418     warnings.filterwarnings(
    419         action='ignore', message='casting datetime64',
    420         category=FutureWarning
    421     )
--> 422     agg = cvs_fn(dfdata, x.name, y.name, agg_fn, **agg_kwargs)
    424 is_where_index = ds15 and isinstance(agg_fn, ds.where) and isinstance(agg_fn.column, rd.SpecialColumn)
    425 is_summary_index = isinstance(agg_fn, ds.summary) and "index" in agg

File ~/miniconda3/envs/census/lib/python3.12/site-packages/datashader/core.py:474, in Canvas.line(self, source, x, y, agg, axis, geometry, line_width, antialias)
    466     if not isinstance(non_cat_agg, (
    467         rd.any, rd.count, rd.max, rd.min, rd.sum, rd.summary, rd._sum_zero,
    468         rd._first_or_last, rd.mean, rd.max_n, rd.min_n, rd._first_n_or_last_n,
    469         rd._max_or_min_row_index, rd._max_n_or_min_n_row_index, rd.where,
    470     )):
    471         raise NotImplementedError(
    472             f"{type(non_cat_agg)} reduction not implemented for antialiased lines")
--> 474 return bypixel(source, self, glyph, agg, antialias=glyph.antialiased)

File ~/miniconda3/envs/census/lib/python3.12/site-packages/datashader/core.py:1333, in bypixel(source, canvas, glyph, agg, antialias)
   1330 source, dshape = _bypixel_sanitise(source, glyph, agg)
   1332 schema = dshape.measure
-> 1333 glyph.validate(schema)
   1334 agg.validate(schema)
   1335 canvas.validate()

File ~/miniconda3/envs/census/lib/python3.12/site-packages/datashader/glyphs/points.py:132, in _PointLike.validate(self, in_dshape)
    130     raise ValueError('x must be real')
    131 elif not isreal(in_dshape.measure[str(self.y)]):
--> 132     raise ValueError('y must be real')

ValueError: y must be real
@hoxbro
Copy link
Member

hoxbro commented Jul 29, 2024

I can't seem to recreate the following:
image

What are your versions? Can you try again and see if you still see the problem or paste in the output of hv.show_versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants