Counting points is easy (see below). Is there a way in which I can calculate point density, e.g. by accessing the area of each pixel from within datashader?
As a workaround I could fix the datashading parameters (x_sampling etc.) and then calculate pixel area based on those parameters but that quickly gets cumbersome e.g. in
Two spinoff ideas:
- Ideally of course there’d be a named reduction, e.g.
- Even more general, one could make accessible
pixel_areaand somehow allow chaining that into the reductions.
import numpy as np import holoviews as hv from holoviews.operation.datashader import rasterize import datashader as dsh e = hv.Points(np.random.randn(1000, 1000)) rasterize(e, aggregator=dsh.count())