Is there a way to access the aggregated data contained in, e.g.,
import holoviews as hv
import numpy as np
hv.HexTiles(np.random.rand(100,2)).options(gridsize=4)
that is the locations and values (here: counts) of all hexagons?
There is, matplotlib performs the aggregation internally but the bokeh backend uses an operation that returns the aggregated data, and q
and r
coordinates, which define the hex grid. You can import and use the operation like this:
import holoviews as hv
import numpy as np
from holoviews.plotting.bokeh.hex_tiles import hex_binning
hextiles = hv.HexTiles(np.random.rand(100,2))
df = hex_binning(hextiles, gridsize=4).dframe()
df.head()
If you need to compute the hexagon's x/y-locations you'll have to read up on hexagon offset coordinates.