def plot_scatter_demo(connection):
qstring = 'select spottime,generation, co2outputrate, co2intensity from "ENAPPSYS.CO2INST"'
print("Submitting query " + qstring)
df = pd.read_sql_query(qstring, connection, index_col='spottime')
plt.figure()
grps = df.groupby(lambda x : x.year)
for year, group in grps:
print "Histogramming..."
plt.hist2d(group['generation'], group['co2intensity'], bins=100, cmap='jet', norm=LogNorm())
plt.colorbar()
print "And... relax... all done"