Lifemap.layer_text

Lifemap.layer_text(
    data=None,
    *,
    taxid_col='taxid',
    text,
    font_size=12,
    font_family='Segoe UI, Helvetica, sans-serif',
    color='#FFFFFF',
    stroke='#000000',
    opacity=1.0,
    declutter=True,
    lazy=False,
    lazy_zoom=15,
    lazy_mode='self',
)

Add a text labels layer.

It can be used to display text labels alongside species identified by their taxids.

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'
text str Name of a column of the data containing text to be displayed. required
font_size int Text font size, by default 12. 12
font_family str CSS-like font family definition, by default “Segoe UI, Helvetica, sans-serif”. 'Segoe UI, Helvetica, sans-serif'
color str CSS text color specification, by default “#FFFFFF”. '#FFFFFF'
stroke str CSS stroke color specification, by default “#000000”. '#000000'
opacity float Text opacity as a floating number between 0 and 1, by default 1.0. 1.0
declutter bool If True, use OpenLayers decluttering option for this layer. Defaults to True. True
lazy bool If True, points are displayed depending on the widget view. If False, all points are displayed. Can be useful when displaying a great number of items. Defaults to False. False
lazy_zoom int If lazy true, only points with a zoom level less than (zoom + lazy_zoom) level will be displayed. Defaults to 15. 15
lazy_mode Literal['self', 'parent'] If lazy is True, choose the zoom level to apply to each taxa. If “self”, keep the taxa zoom level. If “parent”, get the nearest ancestor zoom level. Defaults to “self”. 'self'

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,
...         ],
...         "value": list("ABCDEFGHIJK"),
...     }
... )
>>> Lifemap(d).layer_text(text="value", font_size=14).show()