NIRS Graph for Animal Grant


In [18]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#have graphs in ipython notebook
%matplotlib inline 
import scipy.stats
import pylab

In [19]:
df = pd.read_csv('/Users/John/Desktop/ROP Python/NIRSrawfigure.csv')

In [20]:
avgs = []
sems = []
for i in range(0,24):
    avgs.append(df[[i]].mean().values)
    seems = scipy.stats.sem(df[[i]], nan_policy='omit')
    sems.append(seems)

In [25]:
x = np.arange(0, 24)
y = avgs
plt.errorbar(x, y, yerr=sems)
plt.plot(x, y)
pylab.xlim([-1,25])
pylab.ylim([70, 90])

#need to learn how to make it prettier


Out[25]:
(70, 90)

In [16]:
#x = np.arange(0, 24)
#y = avgs
#from last cell block

(_, caps, _) = plt.errorbar(x,y, yerr=sems, capsize=5, elinewidth=1)

for cap in caps:
    cap.set_color('black')
    cap.set_markeredgewidth(.5)



In [ ]:
savgs = pd.Series(avgs)
zavgs = savgs.astype(int)

In [ ]:
'''import plotly.plotly as py
import plotly.graph_objs as go
import plotly
print plotly.__version__            # version 1.9.4 required
plotly.offline.init_notebook_mode() # run at the start of every notebook


data = [
    go.Scatter(
        x[1:24],
        y(zavgs),
        error_y=dict(
            type='data',
            array=sems,
            visible=True
        )
    )
]

plotly.offline.iplot(data)''' #plotly fail

In [ ]: