I'm making a scatterplot with matplotlib based on a dictionary, where the dictionary maps a two-element tuple to an integer value. The coordinate represented by the tuple is plotted, and then is colored based on the value of the integer it maps to.
xs = [tup[0] for tup in list(mydict.keys())]
ys = [tup[1] for tup in list(mydict.keys())]
colors = ['g' if outcome > 0 else 'r' for outcome in list(mydict.values())]
plt.figure()
plt.subplot(211)
plt.scatter(xs, ys, c = colors, alpha = 0.5, s = 4)
I want to put a legend in the upper right corner of this scatter plot showing that a red dot means "Ineffective" and a green dot means "Effective." Since I draw both colored points in one line, I can't (or don't know how to) give the colors separate label parameters. So, how can I create the legend?