import numpy as np import matplotlib.pylab as plt from matplotlib import cm from matplotlib.colors import LogNorm %matplotlib inline file = 'art_cleaned.csv' data = np.recfromcsv(file) z = plt.hist(data['year'], bins=np.arange(1500,2012,5),histtype='step') plt.yscale('log') plt.ylim((1,1e4)) plt.xlabel('Year') plt.ylabel('# Pieces') #How about Size vs Year? h0 = plt.hist2d(data['width'], data['height'],bins=100)#,norm=LogNorm()) #plt.colorbar() h = plt.hist2d(np.log10(data['width']), np.log10(data['height'])/np.log10(data['width']), bins=(200,200),norm=LogNorm()) plt.xlim((1.5,3.5)) plt.ylim((0.5,1.5)) plt.colorbar() h, xi, yi = plt.histogram2d(np.log10(data['width']), np.log10(data['height'])/np.log10(data['width']), bins=(200,300) ) plt.figure(figsize=(10,7)) plt.imshow(np.log10(h+1).T,interpolation='nearest', origin='lower', aspect=2, extent=(np.min(xi),np.max(xi),np.min(yi),np.max(yi)),cmap=cm.BuPu) plt.xlim((1.5,3.5)) plt.ylim((0.6,1.4)) plt.xlabel('Width') # now let's work on drawing squares x1 = np.array([-1, 1, 1, -1, -1], dtype='float') y1 = np.array([-1, -1, 1, 1, -1], dtype='float') # set up the figure plt.figure(figsize=(6,6)) plt.xlim((-5000,5000)) plt.ylim((-5000,5000)) # need to do this for ALL the length of data, not just first 100 for i in range(0, 100): plt.plot(x1*data['width'][i], y1*data['height'][i],'k',alpha=0.1)