Plots of Data in 3D, and Other Such Figures


In [2]:
%matplotlib inline

import matplotlib.pyplot as plt
import numpy
import csv

fig = plt.figure()
#ax = fig.add_subplot(111, projection='3d')


<matplotlib.figure.Figure at 0x112128950>

In [3]:
data = open('../data/data.csv', 'r').readlines()
fieldnames = ['x', 'y', 'z', 'unmasked', 'synapses']
reader = csv.reader(data)
reader.next()

rows = []
rows_ = [[int(col) for col in row] for row in reader]
for r in rows_:
    if r[-2] is not 0:
        rows.append(r)

xs = [r[0] for r in rows]
ys = [r[1] for r in rows]
zs = [r[2] for r in rows]
ss = [r[-1]/100. for r in rows]

cmap = plt.get_cmap('cubehelix')
indices = numpy.linspace(0, cmap.N, len(ss))
my_colors = [cmap(int(i)) for i in indices]

In [19]:
plt.scatter(xs, ys, s=ss, c=my_colors)#depthshade=True)#, *args, **kwargs)
plt.show()



In [ ]: