This notebook plots the number of origins of viviparity and reversions to oviparity, broken down by tree. The result is a grouped histogram.


In [1]:
import pandas as pd
from pandas import *
import matplotlib.pyplot as plt
%matplotlib inline
from ggplot import *
from numpy import random 
plt.style.use('ggplot')

Read data using pandas.


In [3]:
data = pd.read_csv("../Data/Histogram/pared_down.csv")
data


Out[3]:
Tree Reversions Origins Parameter
0 0 32 21 NP
1 0 24 25 1p
2 0 26 24 2p
3 5684 24 22 NP
4 5684 20 23 1p
5 5684 26 20 2p
6 5870 28 18 NP
7 5870 17 28 1p
8 5870 26 18 2p
9 83796 35 18 NP
10 83796 33 22 1p
11 83796 42 18 2p

In [99]:
data.columns


Out[99]:
Index([u'diff', u'vo', u'Term', u'Improvement'], dtype='object')

Pivot the table to group the data by tree.


In [ ]:
table = pivot_table(data, index=['Tree'], columns=['Parameter'])
table

Plot using native pandas plotting.


In [32]:
table.plot(kind='bar', width=.7, sort_columns=True).set_ylim(0,75)

plt.tight_layout()
plt.savefig('exTotal.svg', bbox_inches='tight', dpi=300)



In [81]:


In [ ]: