Created
          November 8, 2015 18:19 
        
      - 
      
- 
        Save balkian/e654835d4263378a3ac8 to your computer and use it in GitHub Desktop. 
    Matplotlib tricks
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | from matplotlib.pyplot import cm | |
| color=cm.rainbow(np.linspace(0,1,len(emotions))) | |
| color = dict(zip(emotions, color)) | |
| color | 
  
    
      This file contains hidden or 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.patches as mpatches | |
| import matplotlib.pyplot as plt | |
| red_patch = mpatches.Patch(color='red', label='The red data') | |
| plt.legend(handles=[red_patch]) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment