foliplus.HeatmapControl#
- class foliplus.HeatmapControl(*, position: Literal['topleft', 'topright', 'bottomleft', 'bottomright'] = 'topleft', color_scheme: str = 'Reds', method: Literal['jenks', 'quantile', 'equal', 'heads'] = 'jenks', n_classes: int = 6, agg: Literal['count', 'sum', 'avg', 'min', 'max'] = 'count', schemes: list[str] | None = None, style: dict | None = None, locale: str | LocaleConfig | None = None)[source]#
Bases:
BaseControlH3 hexbin heatmap with zoom-adaptive resolution and labeled hexagons.
Note
Only markers with a
.featureproperty (GeoJSON /df.explore) are counted. Annotation or label markers without.featureare skipped to avoid double-counting in hexbin aggregation.Parameters#
- positionstr, default “topleft”
One of
"topleft","topright","bottomleft","bottomright".- color_schemestr, default “Reds”
Default color scheme name. Supports chroma.js / ColorBrewer palettes:
Blues,Greens,Reds,Oranges,Purples,YlOrRd,Viridis.- methodLiteral[“jenks”, “quantile”, “equal”, “heads”], default “jenks”
Default classification method.
- n_classesint, default 6
Number of classification classes, range 2-9.
- aggLiteral[“count”, “sum”, “avg”, “min”, “max”], default “count”
Default aggregation method.
- schemeslist[str], optional
List of available color scheme names. Can include custom hex values like
["#f00", "#0f0", "#00f"].- styledict, optional
Grid style overrides. Supported keys:
field(optional) property name to aggregate on.null/"auto"counts features per hexagon; any other string aggregates that numeric property.border_weight(float, default 1.5) border widthborder_color(str, default “#333333”) border colorfill_opacity(float, default 0.7) fill opacityborder_opacity(float, default 0.9) border opacitylabel_show(bool, default True) show aggregated value at hex centerlabel_size(int, default 11) label font sizelabel_color(str, default “#fff”) label colorlabel_format(str, default “auto”) number format:"auto"(10K/1K suffix),"int","comma"(thousands separator)
- localestr or LocaleConfig, optional
Language code (
"en","zh") or aLocaleConfiginstance. Defaults to auto-detection, falling back to English.
Examples#
>>> import folium >>> from foliplus import HeatmapControl >>> m = folium.Map() >>> HeatmapControl().add_to(m)
- __init__(*, position: Literal['topleft', 'topright', 'bottomleft', 'bottomright'] = 'topleft', color_scheme: str = 'Reds', method: Literal['jenks', 'quantile', 'equal', 'heads'] = 'jenks', n_classes: int = 6, agg: Literal['count', 'sum', 'avg', 'min', 'max'] = 'count', schemes: list[str] | None = None, style: dict | None = None, locale: str | LocaleConfig | None = None)[source]#
Methods
__init__(*[, position, color_scheme, ...])add_child(child[, name, index])Add a child.
add_children(child[, name, index])Add a child.
add_css_link(name, url)Add or update css resource link.
add_js_link(name, url)Add or update JS resource link.
add_to(parent[, name, index])Add element to a parent.
get_bounds()Computes the bounds of the object and all it's children in the form [[lat_min, lon_min], [lat_max, lon_max]].
get_name()Returns a string representation of the object.
get_root()Returns the root of the elements tree.
render(**kwargs)Renders the HTML representation of the element.
save(outfile[, close_file])Saves an Element into a file.
to_dict([depth, ordered])Returns a dict representation of the object.
to_json([depth])Returns a JSON representation of the object.
Attributes
default_cssdefault_js