Skip to content

Instantly share code, notes, and snippets.

@nipunbatra
Created March 4, 2014 08:49
Show Gist options
  • Save nipunbatra/9342617 to your computer and use it in GitHub Desktop.
Save nipunbatra/9342617 to your computer and use it in GitHub Desktop.
from nilmtk.plots import latexify, format_axes
import matplotlib.pyplot as plt
import pandas as pd
df_idx=pd.date_range(start="2014-01-01", freq="D", periods=7)
normal = pd.Series([75,83,75,79,49,74,83],index=df_idx)
off_peak = pd.Series([53,50,48,56,44,42,58],index=df_idx)
peak = pd.Series([43,42,44,34,28,47,41],index=df_idx)
df = pd.DataFrame({'peak':peak,'normal':normal,'off peak':off_peak}, index=df_idx)
from mpltools import style
style.use('ggplot')
latexify(columns=1)
df.plot(kind='bar',stacked=True,rot=0)
plt.ylim((0,300))
plt.ylabel("Energy (KWh)")
plt.tight_layout()
format_axes(plt.gca())
plt.savefig("/home/nipun/Desktop/tod.pdf")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment