Skip to content

Instantly share code, notes, and snippets.

@Skanda319
Created April 22, 2019 00:45
Show Gist options
  • Save Skanda319/951879ba972bd91b9d7906a4ebb7a649 to your computer and use it in GitHub Desktop.
Save Skanda319/951879ba972bd91b9d7906a4ebb7a649 to your computer and use it in GitHub Desktop.
sns.set(font_scale=1.25)
style_kwds = {'xtick.major.size': 3, 'ytick.major.size': 3,
'font.family':u'courier prime code', 'legend.frameon': True}
sns.set_style('white', style_kwds)
fig, axs = plt.subplots(model.n_components, sharex=True, sharey=True, figsize=(12,9))
colors = cm.rainbow(np.linspace(0, 1, model.n_components))
for i, (ax, color) in enumerate(zip(axs, colors)):
# Use fancy indexing to plot data in each state.
mask = hidden_states == i
ax.plot_date(X_test.index.values[mask],
X_test["close"].values[mask],
".-", c=color)
ax.set_title("{0}th hidden state".format(i), fontsize=16, fontweight='demi')
# Format the ticks.
ax.xaxis.set_major_locator(YearLocator())
ax.xaxis.set_minor_locator(MonthLocator())
sns.despine(offset=10)
plt.tight_layout()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment