Skip to content

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

@ahuang11

Description

@ahuang11

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions