author: lukethompson@gmail.com
date: 27 Feb 2017
language: Python 3.5
conda enviroment: emp-py3
license: unlicensed

sourcetracker_mixing_proportions.ipynb


In [1]:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
%matplotlib inline

In [2]:
path_all = '~/emp/analyses-sourcetracker/from-nick/mixing_proportions_all.txt'
path_loo = '~/emp/analyses-sourcetracker/from-nick/mixing_proportions_loo.txt'

In [3]:
df_all = pd.read_csv(path_all, sep='\t', index_col=0)
df_loo = pd.read_csv(path_loo, sep='\t', index_col=0)

In [4]:
df_all.drop(['Hypersaline (saline)', 'Surface (saline)'], axis=0, inplace=True)

In [5]:
df_loo.replace(to_replace=0, value=np.nan, inplace=True)

In [6]:
df_all.shape


Out[6]:
(15, 14)

In [7]:
df_loo.shape


Out[7]:
(17, 16)

In [8]:
# EXAMPLE
# sns.heatmap(corr, mask=mask, cmap=cmap, vmax=.3,
#             square=True, xticklabels=5, yticklabels=5,
#             linewidths=.5, cbar_kws={"shrink": .5}, ax=ax)

In [9]:
cmap = sns.cubehelix_palette(8, start=0, rot=-.75, as_cmap=True)

In [10]:
sns.heatmap(df_all, square=True, cmap=cmap)
plt.ylabel('Source')
plt.xlabel('Sink (all included)')
plt.savefig('~/emp/analyses-sourcetracker/mixing_prop_all_sources.pdf', bbox_inches='tight')



In [11]:
sns.heatmap(df_loo, square=True, cmap=cmap)
plt.ylabel('Source')
plt.xlabel('Sink (leave one out)')
plt.savefig('~/emp/analyses-sourcetracker/mixing_prop_leave_one_out.pdf', bbox_inches='tight')



In [ ]: