Layout Elements¶
Title, scale bar, and source attribution are chrome elements set
with convenience methods on the map (m.title / m.scale_bar /
m.source / m.north_arrow). Zoom windows and cartouches remain
dict-based methods; the graticule is a GraticuleLayer.
Title¶
The first argument is the title text; the rest are keyword options.
m.title(
"Population par département",
subtitle="Source : INSEE, 2024",
loc="left",
font_size=14,
font_weight="bold",
top_gap=10,
offset_x=0,
offset_y=0,
)
Key |
Default |
Description |
|---|---|---|
|
required |
Title text. Wrapped automatically at |
|
|
Subtitle rendered below the title. |
|
|
Horizontal alignment: |
|
60 |
Maximum characters per line before wrapping. |
|
from style |
Title font size (scaled by |
|
from style |
Title color. |
|
from style |
Font weight (e.g. |
|
from style |
Font family. |
|
auto |
Subtitle font size (defaults to |
|
from style |
Subtitle color. |
|
|
Subtitle font weight. |
|
8 |
Gap between title baseline and map top edge (SVG px). Positive = title moves up. |
|
0.0 |
Additional horizontal shift (SVG px). |
|
0.0 |
Additional vertical shift (SVG px). |
Scale bar¶
m.scale_bar() # fully automatic
m.scale_bar(length=200_000, label="200 km")
m.scale_bar(location="lower left", color="#444444",
bar_height=4, opacity=0.8)
Key |
Default |
Description |
|---|---|---|
|
auto |
Bar length in map CRS units. Auto: ~20 % of map width. |
|
auto |
Label text. Auto-generated from |
|
|
Unit string appended to auto-label. |
|
1000 |
Divisor for CRS-units to display-units (default: metres to km). |
|
|
Preset position: |
|
|
Manual position |
|
from style |
Unified color for bar, ticks, and label. |
|
from |
Bar line color override. |
|
from |
Tick color override. |
|
from |
Label color override. |
|
8 |
Label font size. |
|
|
Label font weight. |
|
from style |
Label font family. |
|
3 |
Bar line thickness (SVG px). |
|
|
Tick mark height (SVG px). |
|
1 |
Tick stroke width (SVG px). |
|
15 |
Distance from the content edge to the bar (SVG px). |
|
1.0 |
Overall opacity 0-1. |
Source attribution¶
m.source("Source : INSEE")
m.source("Source : INSEE\\nTraitement : auteur", layout="horizontal")
m.source("Source : IGN", position={"x": 0.5, "y": 1.05})
Key |
Default |
Description |
|---|---|---|
|
required |
Attribution text. Use |
|
|
|
|
|
Manual position |
|
90 / 0 |
Explicit rotation in degrees (default depends on layout). |
|
from style |
Font size. |
|
from style |
Text color. |
|
from style |
Text opacity. |
|
|
CSS font-style. |
|
|
CSS font-weight. |
|
from style |
Font family. |
|
auto |
SVG text-anchor: |
Zoom window (add_zoom)¶
m.add_zoom({
"bbox": [586377, 6780533, 739396, 6904563],
"border_radius": 8,
"box_shadow": True,
"glow": False,
})
Key |
Default |
Description |
|---|---|---|
|
required |
Geographic bounding box |
|
auto |
SVG pixel position of the zoom window top-left corner. |
|
auto |
Zoom window size in SVG px. |
|
from style |
Border stroke color. |
|
1 |
Border stroke width (SVG px). |
|
4 |
Corner radius (SVG px, 0 = sharp). |
|
|
Drop shadow: |
|
|
Outer glow: same format as |
Graticule (GraticuleLayer)¶
from mappyng import GraticuleLayer
m.add(GraticuleLayer(step=5.0, stroke="#888888", opacity=0.4,
stroke_width=0.5, dash="4 2"))
Key |
Default |
Description |
|---|---|---|
|
10.0 |
Graticule spacing in degrees. |
|
|
Line color. |
|
0.5 |
Line opacity. |
|
0.5 |
Line width (SVG px). |
|
|
SVG |