In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn
import minst.model
import minst.taxonomy
%matplotlib inline
seaborn.set()
In [2]:
dframe = pd.read_csv("/Users/ejhumphrey/data/minst/master_index.csv", index_col=0)
dframe = minst.taxonomy.normalize_instrument_names(dframe)
dframe.sample(5)
Out[2]:
In [9]:
uiowa = dframe[dframe.dataset == 'uiowa']
rwc = dframe[dframe.dataset == 'rwc']
philz = dframe[dframe.dataset == 'philharmonia']
In [12]:
fig, ax = plt.subplots(figsize=(14, 4))
instruments = sorted(dframe.instrument.unique())
x_axis = np.arange(len(instruments))
datasets = sorted(dframe.dataset.unique())
width = 1. / (len(datasets) + 1)
colors = seaborn.color_palette()
for n, (dset, c) in enumerate(zip(datasets, colors)):
dset_df = dframe[dframe.dataset == dset]
print(dset, len(dset_df))
counts = dset_df.groupby(["instrument"])
ax.bar(x_axis + n * width, counts.instrument.count().values,
width=width, label=dset, fc=c)
ax.set_xticks(x_axis + 0.4)
ax.set_xticklabels(instruments, rotation=20);
ax.set_xlabel("Instrument Class")
ax.set_ylabel("Counts")
ax.set_title("Note Observation Counts")
plt.legend(loc='best')
Out[12]:
In [21]:
In [ ]:
In [ ]: