Skip to content

Instantly share code, notes, and snippets.

@bearpelican
Created August 19, 2020 20:08
Show Gist options
  • Save bearpelican/0601ab5da68bca46f74953f36ee6085d to your computer and use it in GitHub Desktop.
Save bearpelican/0601ab5da68bca46f74953f36ee6085d to your computer and use it in GitHub Desktop.
points = [
('L-ALam_Apex', '1', 'blue'),
('L-ALam_Tip', '2', 'yellow'),
('L-ALam_Touch','3', 'red'),
('L-A_eP-Bend', '7', 'orange'),
('L-A_eP-End', '8', 'white'),
('L-A_eP-Top', '6', 'green'),
('R-ALam_Apex', '11', 'blue'),
('R-ALam_Tip', '12', 'yellow'),
('R-ALam_Touch','13', 'red'),
('R-A_eP-Bend', '17', 'orange'),
('R-A_eP-End', '18', 'white'),
('R-A_eP-Top', '16', 'green'),
]
names = [x[0] for x in points]
colors = [x[2] for x in points]
labels = [Label(text=n) for n in names]
import matplotlib as mpl
import matplotlib.patches as mpatches
import matplotlib.pyplot as plt
cmap = mpl.colors.ListedColormap(colors)
patches = [mpatches.Patch(color=c, label=l) for c,l in zip(colors,names)]
def show_legend(): plt.legend(handles=patches, bbox_to_anchor=(1, 1), loc='upper left')
show_legend()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment