[python] Remove or adapt border of frame of legend using matplotlib

When plotting a plot using matplotlib:

  1. How to remove the box of the legend?
  2. How to change the color of the border of the legend box?
  3. How to remove only the border of the box of the legend?

This question is related to python matplotlib

The answer is


One more related question, since it took me forever to find the answer:

How to make the legend background blank (i.e. transparent, not white):

legend = plt.legend()
legend.get_frame().set_facecolor('none')

Warning, you want 'none' (the string). None means the default color instead.