Legend
plotynium.legends.Legend
Legend(color_mapping=None, symbol_mapping=None, scheme=None, square_size=15, symbol_size=5, fill=None, fill_opacity=1.0, stroke=None, stroke_opacity=1.0, stroke_width=1.0, font_size=12, width=240, height=50, margin_top=21, margin_left=15, margin_bottom=21, margin_right=15)
Special mark which has its own definition for making a legend. Legend is
located on top of the main canvas where all other marks are applied. Given
the value of color_mapping
and symbol_mapping
arguments, this class
takes decision to know if the legend should be continuous, discrete with
squares or discrete with symbols.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
list[tuple[str, str]] | None
|
List of pairs (label, color) |
None
|
|
list[tuple[str, str]] | None
|
List of pairs (label, symbol path) |
None
|
|
ColorScheme | None
|
Color scheme |
None
|
|
int
|
Square_size (only for discrete legend) |
15
|
|
int
|
Symbol size (only for symbol legend) |
5
|
|
str | None
|
Fill color for text |
None
|
|
float
|
Fill opacity |
1.0
|
|
str | None
|
Stroke color for text |
None
|
|
float
|
Stroke opacity |
1.0
|
|
float
|
Stroke width (only for continuous legend) |
1.0
|
|
int
|
Font size for text |
12
|
|
int
|
Width size |
240
|
|
int
|
Height size |
50
|
|
int
|
Margin top value |
21
|
|
int
|
Margin left value |
15
|
|
int
|
Margin bottom value |
21
|
|
int
|
Margin right value |
15
|
Source code in plotynium/legends/__init__.py
properties
property
apply
Adds a legend on SVG content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
Selection
|
SVG Content |
required |
|
Context
|
Context |
required |