lang = "en"
#lang = "tr"
import numpy as np
import matplotlib.pyplot as plt
import sys
import pandas as pd
import seaborn as sns
sns.set_theme(style="whitegrid")
# Data from https://di.unfccc.int/detailed_data_by_party
# Select Turkey, All Years, Totals, Aggregate GHG, Mt CO2 equivalent
# Cut and paste in here: Total GHG emissions without LULUCF
# Older figures are sometimes revised so maybe worth recopying them all occasionally
# However new data is likely to be released first at https://unfccc.int/ghg-inventories-annex-i-parties/2021
Year = ('1990','1991','1992','1993','1994','1995','1996','1997','1998','1999','2000','2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013','2014','2015','2016','2017','2018')
GHG = [ 219.20,226.58,232.80,240.15,234.13,247.58,267.23,278.61,280.29,277.76,298.89,280.41,286.07,305.60,314.95,337.21,358.15,391.42,387.59,395.52,398.66,427.57,446.94,438.97,457.96,472.19,498.47,523.8,520.9]
Number_of_years = len(Year)
#assign lists to a value
data = {'Year': Year, 'GHG': GHG}
#convert dictionary to a dataframe
df = pd.DataFrame(data)
#Print out all rows
df[:Number_of_years]
# Set font size as default was a bit small to read
fontsize = 'large'
fig, ax1 = plt.subplots(figsize=(10,6))
#Avoid squashing up years
plt.xticks(rotation=45)
ax1 = sns.barplot(x='Year', y='GHG', data = df, color = 'grey')
#Don't need the word "Year" at the bottom
ax1.set_xlabel('Source: https://di.unfccc.int/detailed_data_by_party Total GHG emissions without LULUCF', fontsize = 'small', color = 'grey')
if lang == "en":
ax1.set_title ("Greenhouse gases emitted in Turkey", fontsize = fontsize)
ax1.set_ylabel("Million metric tons of carbon dioxide equivalent", fontsize = fontsize)
elif lang == "tr":
ax1.set_title (" Needs translating", fontsize = fontsize)
ax1.set_ylabel("Megatonne", fontsize = fontsize)
else:
print("Unknown language " + lang)
sys.exit()
#Don't need the frame
sns.despine(bottom = True, left = True)
#Don't need the dash marks
ax1.tick_params(left=False, bottom=False)
# Save graphic
plt.savefig('ghg_without_LULUCF_bar_chart_Turkey.svg')
# Show graphic
plt.show()