def plot_total_energy_pie(n, ax=None): """Add total energy pie plot""" if ax is None: ax = plt.gca() ax.set_title('Energy per technology', fontdict=dict(fontsize="medium")) e_primary = aggregate_p(n).drop('load', errors='ignore').loc[lambda s: s>0] patches, texts, autotexts = ax.pie(e_primary, startangle=90, labels = e_primary.rename(opts['nice_names_n']).index, autopct='%.0f%%', shadow=False, colors = [opts['tech_colors'][tech] for tech in e_primary.index]) for t1, t2, i in zip(texts, autotexts, e_primary.index): if e_primary.at[i] < 0.04 * e_primary.sum(): t1.remove() t2.remove()
def plot_total_energy_pie(n, ax=None): if ax is None: ax = plt.gca() ax.set_title("Energy per technology", fontdict=dict(fontsize="medium")) e_primary = aggregate_p(n).drop("load", errors="ignore").loc[lambda s: s > 0] patches, texts, autotexts = ax.pie( e_primary, startangle=90, labels=e_primary.rename(opts["nice_names"]).index, autopct="%.0f%%", shadow=False, colors=[opts["tech_colors"][tech] for tech in e_primary.index], ) for t1, t2, i in zip(texts, autotexts, e_primary.index): if e_primary.at[i] < 0.04 * e_primary.sum(): t1.remove() t2.remove()
labels.append(opts['nice_names'].get(t, t)) l3 = ax.legend(handles, labels, loc="upper center", bbox_to_anchor=(0.5, -0.), # bbox_to_anchor=(0.72, -0.05), handletextpad=0., columnspacing=0.5, ncol=4, title='Technology') fig.savefig(snakemake.output.only_map, dpi=150, bbox_inches='tight', bbox_extra_artists=[l1,l2,l3]) #n = load_network(snakemake.input.network, opts, combine_hydro_ps=False) ## Add total energy p ax1 = ax = fig.add_axes([-0.115, 0.625, 0.2, 0.2]) ax.set_title('Energy per technology', fontdict=dict(fontsize="medium")) e_primary = aggregate_p(n).drop('load', errors='ignore').loc[lambda s: s>0] patches, texts, autotexts = ax.pie(e_primary, startangle=90, labels = e_primary.rename(opts['nice_names_n']).index, autopct='%.0f%%', shadow=False, colors = [tech_colors[tech] for tech in e_primary.index]) for t1, t2, i in zip(texts, autotexts, e_primary.index): if e_primary.at[i] < 0.04 * e_primary.sum(): t1.remove() t2.remove() ## Add average system cost bar plot # ax2 = ax = fig.add_axes([-0.1, 0.2, 0.1, 0.33]) # ax2 = ax = fig.add_axes([-0.1, 0.15, 0.1, 0.37])
ncol=4, title='Technology') fig.savefig(snakemake.output.only_map, dpi=150, bbox_inches='tight', bbox_extra_artists=[l1, l2, l3]) #n = load_network(snakemake.input.network, opts, combine_hydro_ps=False) ## Add total energy p ax1 = ax = fig.add_axes([-0.115, 0.625, 0.2, 0.2]) ax.set_title('Energy per technology', fontdict=dict(fontsize="medium")) e_primary = aggregate_p(n).drop('load').loc[lambda s: s > 0] patches, texts, autotexts = ax.pie( e_primary, startangle=90, labels=e_primary.rename(opts['nice_names_n']).index, autopct='%.0f%%', shadow=False, colors=[tech_colors[tech] for tech in e_primary.index]) for t1, t2, i in zip(texts, autotexts, e_primary.index): if e_primary.at[i] < 0.04 * e_primary.sum(): t1.remove() t2.remove() ## Add average system cost bar plot # ax2 = ax = fig.add_axes([-0.1, 0.2, 0.1, 0.33])