fig = create_figure((2.4, 2))
    ax = create_axis_at_location(fig, 0.5, 0.5, 1.5, 1.)
    ax.plot(np.arange(0, N_states), Is, color=color)
    ax.set_xlabel('Latent state')
    ax.set_xlim([0, N_states])
    ax.set_ylabel("bits")
    ax.set_title('Mutual Information')
    fig.savefig(os.path.join(figdir, 'figure10.pdf'))
    plt.close(fig)


# Load the data
dataset = "hipp_2dtrack_a"
N, S_train, pos_train, S_test, pos_test, center, radius = \
    load_hipp_data(dataname=dataset)

# Load results
runnum = 2
results_dir = os.path.join("results", dataset, "run%03d" % runnum)
results_type = "hdphmm_scale_alpha_obs2.0"
results_file = os.path.join(results_dir, results_type + ".pkl.gz")
print "Loading ", results_file
with gzip.open(results_file, "r") as f:
    results = cPickle.load(f)

# Compute the mutual info
# mutual_info_ss_pos(results, pos_train, center, radius)
# mutual_info_per_location(smpls, pos_train, center, radius)
mutual_info_per_state(results, pos_train, center, radius, figdir=results_dir)
    ax.set_yticklabels(np.arange(0,C, step=stepC))
    ax.set_title('$\\mathbf{\Lambda}$')
    plt.figtext(2.5/5, 1.55/5, "F")

    # Add colorbar for firing rate matrix
    # cbax = fig.add_subplot(gs[2,-1])
    cbax = create_axis_at_location(fig, 4.4, .5, .1, 1.)
    cbar = Colorbar(cbax, im, ticks=np.arange(0,16.1, step=1), label="spikes/bin")

    fig.savefig(os.path.join(figdir, 'figure6.pdf'))
    fig.savefig(os.path.join(figdir, 'figure6.png'))

    print "Plots can be found at %s*.pdf" % os.path.join(figdir, 'figure6')

# Figure 7: Hippocampal inference trajectories
dataset = "hipp_2dtrack_a"
N, S_train, pos_train, S_test, pos_test, center, radius = \
    load_hipp_data(dataname=dataset)

# Load results
runnum = 1
results_dir = os.path.join("results", dataset, "run%03d" % runnum)
results_type = "hdphmm_scale"
results_file = os.path.join(results_dir, results_type + ".pkl.gz")
with gzip.open(results_file, "r") as f:
    results = cPickle.load(f)

plot_results(results,
             S_train,
             figdir=results_dir)