Skip to content

Commit 641e3de

Browse files
authored
Merge pull request matplotlib#27764 from saranti/legendguide
Increase size of legend in Legend guide example
2 parents 5a8220e + b06c5b7 commit 641e3de

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

galleries/users_explain/axes/legend_guide.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,13 @@
260260
line1, = ax.plot([3, 2, 1], marker='o', label='Line 1')
261261
line2, = ax.plot([1, 2, 3], marker='o', label='Line 2')
262262

263-
ax.legend(handler_map={line1: HandlerLine2D(numpoints=4)})
263+
ax.legend(handler_map={line1: HandlerLine2D(numpoints=4)}, handlelength=4)
264264

265265
# %%
266266
# As you can see, "Line 1" now has 4 marker points, where "Line 2" has 2 (the
267-
# default). Try the above code, only change the map's key from ``line1`` to
267+
# default). We have also increased the length of the handles with the
268+
# ``handlelength`` keyword to fit the larger legend entry.
269+
# Try the above code, only change the map's key from ``line1`` to
268270
# ``type(line1)``. Notice how now both `.Line2D` instances get 4 markers.
269271
#
270272
# Along with handlers for complex plot types such as errorbars, stem plots

0 commit comments

Comments
 (0)