|
import pandas as pd |
|
import matplotlib.pyplot as plt |
|
import seaborn as sns |
|
import matplotlib.dates as mdates |
|
|
|
|
|
file_path = '/home/daniel/Git/Emissions-Monetisation-Calculator/proposals/versions/latest/scc-proposals.csv' |
|
df = pd.read_csv(file_path) |
|
|
|
|
|
df['date'] = pd.to_datetime(df['date'], errors='coerce') |
|
|
|
|
|
df['usd_proposed_value'] = pd.to_numeric(df['usd_proposed_value'], errors='coerce') |
|
|
|
|
|
|
|
df_filtered = df.dropna(subset=['date', 'usd_proposed_value']).copy() |
|
|
|
|
|
df_filtered = df_filtered.sort_values('date') |
|
|
|
|
|
|
|
org_name_map = { |
|
"International Foundation for Valuing Impacts": "IFVI", |
|
"Environmental Protection Agency": "EPA", |
|
"University of California, Davis": "UC Davis", |
|
"International Monetary Fund": "IMF", |
|
"New York State Agencies": "NY State", |
|
"Biden Administration Interagency Working Group": "Biden Admin", |
|
"Trump Administration": "Trump Admin", |
|
"Climate Leadership Council": "CLC", |
|
"Obama Administration Interagency Working Group": "Obama Admin", |
|
"UK Government Economic Service": "UK Gov", |
|
"Stern Review": "Stern", |
|
"Government of Canada": "Canada Gov", |
|
"Yale University": "Yale", |
|
"Resources for the Future": "RFF", |
|
"University College London": "UCL", |
|
"Cambridge University": "Cambridge" |
|
} |
|
|
|
|
|
df_filtered['short_org'] = df_filtered['organization_name'].map(org_name_map) |
|
|
|
|
|
|
|
plt.figure(figsize=(14, 8)) |
|
|
|
|
|
sns.lineplot(x='date', |
|
y='usd_proposed_value', |
|
hue='short_org', |
|
data=df_filtered, |
|
marker="o", |
|
markersize=8, |
|
linewidth=1 |
|
) |
|
|
|
plt.xlabel('Date') |
|
plt.ylabel('Proposed Social Cost of Carbon (USD/ton)') |
|
plt.title('Social Cost of Carbon Proposals Over Time by Organization') |
|
plt.legend(title='Organization', loc='upper left', bbox_to_anchor=(1, 1)) |
|
|
|
|
|
date_fmt = mdates.DateFormatter('%Y-%b') |
|
plt.gca().xaxis.set_major_formatter(date_fmt) |
|
plt.gca().xaxis.set_major_locator(mdates.YearLocator()) |
|
plt.xticks(rotation=45, ha='right') |
|
|
|
plt.tight_layout(rect=[0, 0, .9, 1]) |
|
|
|
|
|
for org in df_filtered['organization_name'].unique(): |
|
org_df = df_filtered[df_filtered['organization_name'] == org] |
|
short_org = df_filtered['short_org'].loc[df_filtered['organization_name'] == org].iloc[0] |
|
|
|
|
|
latest_point = org_df.iloc[-1] |
|
|
|
|
|
plt.annotate(f"{short_org}", |
|
xy=(latest_point['date'], latest_point['usd_proposed_value']), |
|
xytext=(10, 0), |
|
textcoords='offset points', |
|
arrowprops=dict(arrowstyle='->', connectionstyle='arc3,rad=0.2'), |
|
fontsize=10 |
|
) |
|
|
|
|
|
|
|
plt.grid(True, axis='y', linestyle='--', alpha=0.7) |
|
plt.show() |