Open
Description
Closed a PR that did this, which was probably over engineered. But the main idea is probably still useful.
#11127 is a bit different, it would create many legend entries for a single scatterplot. The idea here was to unify the size of different scatter plot's handles. Many options are shown in the stackoverflow question "setting a fixed size for points in legend". The easiest is just:
legend = plt.legend()
for legobj in legend.legendHandles:
legobj.set_sizes([64])
My faviourite, which I just added to that thread as well would be to use the update function of the Handler.
def update(handle, orig):
handle.update_from(orig)
handle.set_sizes([64])
plt.legend(handler_map={PathCollection : HandlerPathCollection(update_func=update)})
Originally posted by @ImportanceOfBeingErnest in #4257 (comment)