Last active
          December 2, 2019 16:53 
        
      - 
      
- 
        Save sksq96/197159c0058164dfe86da4ccb1684d39 to your computer and use it in GitHub Desktop. 
    Plot histogram from list
  
        
  
    
      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
    
  
  
    
  | def hist(d, count=True): | |
| import matplotlib.pyplot as plt | |
| if count: | |
| d = list(map(len, d)) | |
| n, bins, patches = plt.hist(x=d, bins='auto', color='#0504aa', alpha=0.7, rwidth=0.85) | |
| plt.grid(axis='y', alpha=0.75) | |
| plt.xlabel('Value') | |
| plt.ylabel('Frequency') | |
| maxfreq = n.max() | |
| plt.ylim(ymax=np.ceil(maxfreq / 10) * 10 if maxfreq % 10 else maxfreq + 10) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment