In [7]:
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
%matplotlib inline
import urllib2
import numpy as np
import matplotlib as mpl
mpl.rcParams['font.size'] = 25
mpl.rc('font',family='Times New Roman')
np.set_printoptions(precision=3, suppress=True)
url = ('https://raw.githubusercontent.com/Upward-Spiral-Science'
'/data/master/syn-density/output.csv')
data = urllib2.urlopen(url)
csv = np.genfromtxt(data, delimiter=",")[1:]
fig,ax = plt.subplots()
ax.hist(csv[:,-1],50)
ax.set_yticks([0,4000, 8000, 12000, 16000])
ax.set_xticks([0,150,300,450,600])
ax.set_xlabel('synapses')
plt.subplots_adjust(bottom = 0.2)
plt.savefig('Fig5a.pdf', format='pdf', dpi=1000)
plt.show()
In [8]:
def check_condition(row):
if row[3] == 0:
return False
return True
a = np.apply_along_axis(check_condition, 1, csv)
a = np.where(a == True)[0]
nonZeroMask = csv[a, :]
fig,ax = plt.subplots()
ax.hist(nonZeroMask[:,-1],50)
ax.set_yticks([0,2000, 4000, 6000, 8000])
ax.set_xticks([0,150,300,450,600])
ax.set_xlabel('synapses')
plt.subplots_adjust(bottom = 0.2)
plt.savefig('Fig5b.pdf', format='pdf', dpi=1000)
plt.show()
In [9]:
cleaned = nonZeroMask[nonZeroMask[:,0] >= 409]
cleaned = cleaned[cleaned[:,0] <= 3529]
cleaned = cleaned[cleaned[:,1] >= 1564]
cleaned = cleaned[cleaned[:,1] <= 3124]
fig,ax = plt.subplots()
ax.hist(cleaned[:,-1],50)
ax.set_yticks([0,1000, 2000, 3000])
ax.set_xticks([0,150,300,450,600])
ax.set_xlabel('synapses')
plt.subplots_adjust(bottom = 0.2)
plt.savefig('Fig5c.pdf', format='pdf', dpi=1000)
plt.show()
In [ ]: