Last active
June 26, 2017 16:15
-
-
Save saullocastro/8c6c8beffd2f275f862a4556fc36454e to your computer and use it in GitHub Desktop.
Matplotlib weird behavior with legendHandles[...].set_color
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
import matplotlib.pyplot as plt | |
ax = plt.gca() | |
ax.plot([0, 1], [0, 1], 'k-.', label='label') | |
ax.plot([0, 1], [1, 0], 'ko', label='label 2') | |
leg = ax.legend() | |
leg.legendHandles[0].set_color('red') # Works | |
leg.legendHandles[1].set_color('yellow') # Doesn't work | |
# It depends on the line type that you choose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment