Skip to content

Commit

Permalink
Merge pull request #8 from milankl/pie
Browse files Browse the repository at this point in the history
sorted with a,b,c; %.1f for pie charts
  • Loading branch information
Milan K committed Nov 4, 2019
2 parents e4604e3 + befe88f commit 503f3a6
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
Binary file modified data/data_processed.xlsx
Binary file not shown.
Binary file modified plots/CO2_permode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified plots/carbon_sorted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 9 additions & 4 deletions src/emissions_sorted.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,24 @@

# A FEW COUNTRIES NUMBERED
n_countries1 = [3,20,21,27,36]
n_countries2 = [41,72,80,86,98,99]
n_countries2 = [41,72,80,86,98,99,100,109]
for n,j in enumerate(n_countries1):
ax.text(cnumpercent[j-1]+0.2, ccarbonpercent[j-1]+0.5,"{}".format(n+1), fontsize=5)
ax.text(cnumpercent[j-1]+0.2, ccarbonpercent[j-1]+0.5,chr(97+n), fontsize=5)

for n,j in enumerate(n_countries2):
ax.text(cnumpercent[j-1]+0.2, ccarbonpercent[j]+0.5,"{}".format(n+len(n_countries1)+1), fontsize=5)
ax.text(cnumpercent[j-1]+0.2, ccarbonpercent[j]+0.5,chr(97+n+len(n_countries1)), fontsize=5)

# RECTANGLES
ax.fill_between(x,y1,y2,alpha=0.3,color="k")

countrynames = ["{:d} {:s}".format(i+1,names[n]) for i,n in enumerate(n_countries1+n_countries2)]
# LEGEND
countrynames = [" {:s}".format(names[n]) for i,n in enumerate(n_countries1+n_countries2)]
ax.legend([l1,]*len(countrynames),countrynames,title="Countries",loc=4,handlelength=0,fontsize=7)

for i,n in enumerate(n_countries1+n_countries2):
ax.text(74,45-3.52*i,chr(97+i),fontsize=7,color="k",zorder=10)


ax.set_xlim(0.0,100.0)
ax.set_ylim(0.0,100.0)

Expand Down
4 changes: 2 additions & 2 deletions src/pie_charts_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@

# REALISTIC

wedges1, texts1, autotexts1 = ax1.pie([C1lh,C1sh,C1ra],labels=["Long-haul","Short-haul","Rail"],autopct="%d%%",colors=colors)
wedges1, texts1, autotexts1 = ax1.pie([C1lh,C1sh,C1ra],labels=["Long-haul","Short-haul","Rail"],autopct="%.1f%%",colors=colors)
plt.setp(autotexts1, size=8, weight="bold", color="white")
ax1.axis('equal')
ax1.set_title("a) Travel to EGU19, total %d tC02e" % sum(S1),loc="left",weight="bold")

# RAIL
wedges2, texts2, autotexts2 = ax2.pie([C2lh,C2ra],labels=["Long-haul","Rail"],autopct="%d%%",colors=colors)
wedges2, texts2, autotexts2 = ax2.pie([C2lh,C2ra],labels=["Long-haul","Rail"],autopct="%.1f%%",colors=colors)
plt.setp(autotexts2, size=8, weight="bold", color="white")
ax2.axis('equal')
ax2.set_title("b) All journeys <1500km by rail, total %d tC02e" % sum(S2),loc="left",weight="bold")
Expand Down

0 comments on commit 503f3a6

Please sign in to comment.