Lifemap.layer_screengrid

Lifemap.layer_screengrid(
    data=None,
    *,
    taxid_col='taxid',
    cell_size=30,
    extruded=False,
    opacity=0.5,
)

Add a screengrid layer.

This layer is used to display observations distribution. It should be noted that the visualization is highly sensitive to the zoom level and the map extent.

Parameters

Name Type Description Default
data pl.DataFrame | pd.DataFrame | None Layer data. If not provided, use the base widget data. None
taxid_col str If data is provided, name of the data column with taxonomy ids, by default "taxid" 'taxid'
cell_size int Screen grid cell size, in pixels, by default 30 30
extruded (bool, optionals) If True, show the grid as extruded, by default False False
opacity float Screengrid opacity as a floating point number between 0 and 1, by default 0.5 0.5

Returns

Name Type Description
Lifemap A Lifemap visualization object.

Examples

>>> import polars as pl
>>> from pylifemap import Lifemap
>>> d = pl.DataFrame(
...     {
...         "taxid": [
...             9685,
...             9615,
...             9994,
...             2467430,
...             2514524,
...             2038938,
...             1021470,
...             1415565,
...             1928562,
...             1397240,
...             230741,
...         ],
...     }
... )
>>> Lifemap(d).layer_screengrid().show()