Skip to content
Snippets Groups Projects
ex2_3_2.py 464 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)
    
    Stas Syrota's avatar
    Stas Syrota committed
    from matplotlib.pyplot import figure, hist, show, subplot, xlabel, ylim
    
    bjje's avatar
    bjje committed
    
    
    Stas Syrota's avatar
    Stas Syrota committed
    figure(figsize=(8, 7))
    u = np.floor(np.sqrt(M))
    v = np.ceil(float(M) / u)
    
    bjje's avatar
    bjje committed
    for i in range(M):
    
    Stas Syrota's avatar
    Stas Syrota committed
        subplot(int(u), int(v), i + 1)
        hist(X[:, i], color=(0.2, 0.8 - i * 0.2, 0.4))
    
    bjje's avatar
    bjje committed
        xlabel(attributeNames[i])
    
    Stas Syrota's avatar
    Stas Syrota committed
        ylim(0, N / 2)
    
    
    bjje's avatar
    bjje committed
    show()