def bar_matching_fueltype_totals(figsize=(7,4)):
from . import data
from .collection import Carma_ENTSOE_GEO_OPSD_WRI_matched_reduced
matched = set_uncommon_fueltypes_to_other(
Carma_ENTSOE_GEO_OPSD_WRI_matched_reduced())
matched.loc[matched.Fueltype=='Waste', 'Fueltype']='Other'
geo=set_uncommon_fueltypes_to_other(data.GEO())
carma=set_uncommon_fueltypes_to_other(data.CARMA())
wri=set_uncommon_fueltypes_to_other(data.WRI())
ese=set_uncommon_fueltypes_to_other(data.ESE())
entsoe = set_uncommon_fueltypes_to_other(data.Capacity_stats())
opsd = set_uncommon_fueltypes_to_other(data.OPSD())
entsoedata = set_uncommon_fueltypes_to_other(data.ENTSOE())
matched.Capacity = matched.Capacity/1000.
geo.Capacity = geo.Capacity/1000.
carma.Capacity = carma.Capacity/1000.
wri.Capacity = wri.Capacity/1000.
ese.Capacity = ese.Capacity/1000.
entsoe.Capacity = entsoe.Capacity/1000.
opsd.Capacity = opsd.Capacity/1000.
entsoedata.Capacity = entsoedata.Capacity/1000.
with sns.axes_style('whitegrid'):
fig, (ax1,ax2) = plt.subplots(1,2, figsize=figsize, sharey=True)
databases = lookup([carma, entsoedata, ese, geo, opsd, wri],
keys=[ 'CARMA', 'ENTSOE','ESE', 'GEO','OPSD', 'WRI'], by='Fueltype')
databases.plot(kind='bar', ax=ax1, edgecolor='none')
datamatched = lookup(matched, by='Fueltype')
datamatched.index.name=''
datamatched.name='Matched Database'
datamatched.plot(kind='bar', ax=ax2, #color=cmap[3:4],
edgecolor='none')
ax2.legend()
ax1.set_ylabel('Capacity [GW]')
ax1.xaxis.grid(False)
ax2.xaxis.grid(False)
fig.tight_layout(pad=0.5)
return fig, [ax1,ax2]
评论列表
文章目录