@@ -7,29 +7,32 @@ Example
77.. jupyter-execute ::
88
99 from ipyleaflet import Map, LegendControl
10- mymap = Map(center=(-10,-45), zoom=4)
11- a_legend = LegendControl({"low":"#FAA", "medium":"#A55", "High":"#500"}, name="Legend", position="bottomright")
12- mymap.add_control(a_legend)
13- mymap
10+
11+ m = Map(center=(-10,-45), zoom=4)
12+
13+ legend = LegendControl({"low":"#FAA", "medium":"#A55", "High":"#500"}, name="Legend", position="bottomright")
14+ m.add_control(legend)
15+
16+ m
1417
1518.. jupyter-execute ::
1619
17- # manipulate the legend
20+ # Manipulate the legend
1821
19- # legend title
20- a_legend .name = "Risk" ## set name
21- a_legend .name # get name
22+ # Set/Get legend title
23+ legend .name = "Risk" # Set name
24+ legend .name # Get name
2225
23- # legend content
24- a_legend.legends = {"el1":"#FAA", "el2":"#A55", "el3":"#500"} #set content
25- a_legend.legends # get content
26- a_legend.add_legend_element("el5","#000") # add a legend element
27- a_legend.remove_legend_element("el5") # remove a legend element
26+ # Set/Get legend content
27+ legend.legends = {"el1":"#FAA", "el2":"#A55", "el3":"#500"} # Set content
28+ legend.legends # Get content
2829
30+ legend.add_legend_element("el5","#000") # Add a legend element
31+ legend.remove_legend_element("el5") # Remove a legend element
2932
3033 # legend position
31- a_legend.positionning = "topright"
32- a_legend.positionning # get current positionning
34+ legend.position = "topright" # Set position
35+ legend.position # Get current position
3336
3437Attributes
3538----------
@@ -38,6 +41,6 @@ Attributes
3841Attribute Default Value Doc
3942================ ================ ===
4043position 'topleft' Position of the control, can be 'bottomleft', 'bottomright', 'topleft', or 'topright'
41- legend None a dictionnary that represents the legend
42- title " Legend" LegendControl name
44+ legend None A dictionary containing the name->color mapping that represents the legend
45+ title ' Legend' Legend name
4346================ ================ ===
0 commit comments