您要寻找的后门如下:
# get the width of your widest label, since every label will need # to shift by this amount after we align to the rightshift = max([t.get_window_extent().width for t in legend.get_texts()])for t in legend.get_texts(): t.set_ha('right') # ha is alias for horizontalalignment t.set_position((shift,0))


