Created
November 28, 2012 16:21
-
-
Save mastbaum/4162313 to your computer and use it in GitHub Desktop.
labeling only some plots in matplotlib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Example of labeling only some plots in a matplotlib legend. | |
Tested with matplotlib==1.0.1 | |
''' | |
from matplotlib import pyplot as plt | |
plt.figure(1, facecolor='white') | |
plt.plot([1,2,3,4], [1,2,3,4], label='foo') | |
plt.plot([1,2,3,4], [2,4,6,8]) | |
plt.plot([1,2,3,4], [3,6,9,12], label='bar') | |
plt.legend(loc='lower right') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment