Skip to content

Instantly share code, notes, and snippets.

@seafooler
Created October 20, 2020 09:11
Show Gist options
  • Save seafooler/9858ec2d577d95157872ba90109a8928 to your computer and use it in GitHub Desktop.
Save seafooler/9858ec2d577d95157872ba90109a8928 to your computer and use it in GitHub Desktop.
Add the legend manually
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
red_patch = mpatches.Patch(color='red', label='The red data')
blue_patch = mpatches.Patch(color='blue', label='The blue data')
plt.legend(handles=[red_patch, blue_patch])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment