@@ -12,14 +12,14 @@ What to be displayed
1212====================
1313
1414The legend command has a following call signature::
15-
15+
1616 legend(*args, **kwargs)
17-
17+
1818If len(args) is 2, the first argument should be a list of artist to be
1919labeled, and the second argument should a list of string labels. If
2020len(args) is 0, it automatically generate the legend from label
2121properties of the child artists by calling
22- :meth: `~matplotlib.axes.Axes.get_legend_handles_labels ` method.
22+ :meth: `~matplotlib.axes.Axes.get_legend_handles_labels ` method.
2323For example, *ax.legend() * is equivalent to::
2424
2525 handles, labels = ax.get_legend_handles_labels()
@@ -44,7 +44,7 @@ used as text labels. If label attribute is empty string or starts with
4444 * :class: `~matplotlib.patches.Patch `
4545 * :class: `~matplotlib.collections.LineCollection `
4646 * :class: `~matplotlib.collections.RegularPolyCollection `
47-
47+
4848 Unfortunately, there is no easy workaround when you need legend for
4949 an artist not in the above list (You may use one of the supported
5050 artist as a proxy. See below), or customize it beyond what is
@@ -84,28 +84,28 @@ feeding them to legend call.::
8484 p1, = ax.plot([1,2,3], label="line 1")
8585 p2, = ax.plot([3,2,1], label="line 2")
8686 p3, = ax.plot([2,3,1], label="line 3")
87-
87+
8888 handles, labels = ax.get_legend_handles_labels()
8989
9090 # reverse the order
9191 ax.legend(handles[::-1], labels[::-1])
92-
92+
9393 # or sort them by labels
9494 import operator
9595 hl = sorted(zip(handles, labels),
9696 key=operator.itemgetter(1))
9797 handles2, labels2 = zip(*hl)
98-
98+
9999 ax.legend(handles2, labels2)
100100
101101
102102Using Proxy Artist
103103------------------
104104
105- When you want to display legend for an artist not supported by the
106- matplotlib, you may use other supported artist as a proxy. For
107- example, you may creates an proxy artist without adding it to the axes
108- (so the proxy artist will not be drawn in the main axes) and feet it
105+ When you want to display legend for an artist not supported by
106+ matplotlib, you may use another artist as a proxy. For
107+ example, you may create a proxy artist without adding it to the axes
108+ (so the proxy artist will not be drawn in the main axes) and feed it
109109to the legend function.::
110110
111111 p = Rectangle((0, 0), 1, 1, fc="r")
0 commit comments