In [1]:
import sys
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

In [2]:
sys.path.append('/home/jfear/devel/GalaxyTools/')
from scatterPlot import *


/usr/lib/pymodules/python2.7/matplotlib/__init__.py:1173: UserWarning:  This call to matplotlib.use() has no effect
because the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

  warnings.warn(_use_error_msg)

In [3]:
%qtconsole
%load_ext autoreload
%autoreload 2

In [4]:
fname = '/home/jfear/tmp/load.csv'
dname = '/home/jfear/sandbox/secim/data/design_synthetic.tsv'

In [5]:
dat = pd.read_table(fname, comment='#')
dat.set_index('sampleID', inplace=True)

design = pd.read_table(dname)
design.set_index('sampleID', inplace=True)

merged = dat.join(design, how='left')
grp = merged.groupby('treatment')
cmap = getColors(grp.indices.keys())

In [6]:
merged['colors'] = merged['treatment'].replace(cmap)

In [7]:
fig, ax = plt.subplots()
for i, val in grp:
    c = cmap[i]
    print c
    val.plot('PC1', 'PC2', kind='scatter', c=c, ax=ax)


b
r

In [8]:
val.plot('PC1', 'PC2', kind='scatter', label='bob')


Out[8]:
<matplotlib.axes.AxesSubplot at 0x7fd984178950>

In [ ]: