In [ ]:
import numpy as np
import matplotlib.pylab as plt
from matplotlib import cm
from matplotlib.colors import LogNorm
%matplotlib inline
In [ ]:
file = 'art_cleaned.csv'
In [ ]:
data = np.recfromcsv(file)
In [ ]:
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')
In [ ]:
#How about Size vs Year?
In [ ]:
h0 = plt.hist2d(data['width'], data['height'],bins=100)#,norm=LogNorm())
#plt.colorbar()
In [ ]:
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()
In [ ]:
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 for something completely different... Art -> Data -> Art

In [ ]:
# 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)
In [ ]: