Skip to content
Snippets Groups Projects
ex2_3_2.py 448 B
Newer Older
  • Learn to ignore specific revisions
  • bjje's avatar
    bjje committed
    import numpy as np
    
    # (requires data from exercise 2.3.1 so will run that script first)
    
    bjje's avatar
    bjje committed
    import matplotlib.pyplot as plt
    
    bjje's avatar
    bjje committed
    
    
    bjje's avatar
    bjje committed
    plt.figure(figsize=(8, 7))
    
    Stas Syrota's avatar
    Stas Syrota committed
    u = np.floor(np.sqrt(M))
    v = np.ceil(float(M) / u)
    
    bjje's avatar
    bjje committed
    for i in range(M):
    
    bjje's avatar
    bjje committed
        plt.subplot(int(u), int(v), i + 1)
        plt.hist(X[:, i], color=(0.2, 0.8 - i * 0.2, 0.4))
        plt.xlabel(attributeNames[i])
        plt.ylim(0, N / 2)
    
    Stas Syrota's avatar
    Stas Syrota committed
    
    
    bjje's avatar
    bjje committed
    plt.show()
    
    bjje's avatar
    bjje committed