Lifemap.layer_icons
Lifemap.layer_icons(
icon,
width=None,
height=None,
color=None,
x_offset=0,
y_offset=0,
x_anchor=0.5,
y_anchor=0.5,
opacity=1.0,
popup=False,
)Add an icons layer.
It can be used to display icons associated to taxids.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| icon | str | Either the URL to an image file to use as icon, or the name of a column of the data containing urls of icons to be displayed. | required |
| width | int | None | Image width, in pixels. If None, use native image width, by default None. | None |
| height | int | None | Image height, in pixels. If None, use native image height, by default None. | None |
| color | str | None | CSS color to tint the icon, by default None. | None |
| x_offset | int | Horizontal offset in pixels, by default 0. | 0 |
| y_offset | int | Vertical offset in pixels, by default 0. | 0 |
| x_anchor | float | Horizontal icon anchor, as a number between 0 and 1, by default 0.5. | 0.5 |
| y_anchor | float | Vertical icon anchor, as a number between 0 and 1, by default 0.5. | 0.5 |
| opacity | float | Text opacity as a floating number between 0 and 1, by default 1.0. | 1.0 |
| popup | bool | If True, display informations in a popup when an icon is clicked, by default False. | False |
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_icons(icon="https://openlayers.org/en/latest/examples/data/icon.png").show()