In [1]:
import os
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
plt.style.use('ggplot')
get_ipython().magic('pylab inline')
In [2]:
# Cartelle Input/Output
dir_df = os.path.join(os.path.abspath(''),'stg')
dir_out = os.path.join(os.path.abspath(''),'output')
In [3]:
df_g7_n_filename = r'df_g7_nord.pkl'
df_g7_n_fullpath = os.path.join(dir_df, df_g7_n_filename)
df_g7_nord = pd.read_pickle(df_g7_n_fullpath)
df_g7_s_filename = r'df_g7_sud.pkl'
df_g7_s_fullpath = os.path.join(dir_df, df_g7_s_filename)
df_g7_sud = pd.read_pickle(df_g7_s_fullpath)
In [4]:
# Plot figure with subplots of different sizes
fig = plt.figure(1)
# set up subplot grid
gridspec.GridSpec(1,2)
Out[4]:
In [5]:
fig, axes = plt.subplots(nrows=1, ncols=2)
tp1 = df_g7_nord.plot(
kind='line',
legend = True,
ylim=(0,40),
ax=axes[0]
)
tp2 = df_g7_sud.plot(
kind='line',
legend = False,
ylim=(0,40),
ax=axes[1]
)
tp1.set_xlabel("")
tp1.set_ylabel("")
axes[0].set_title('Nord')
axes[1].set_title('Sud')
tp2.set_xlabel("")
tp2.grid(True)
tp2.set_yticklabels([])
tp1.legend(loc='upper right',prop={'size':8})
plt.subplots_adjust(hspace=0.0, wspace=0.02, bottom=0.2)
fig.savefig(os.path.join(dir_out,'G7_Reddito_Popolazione.png'), format='png', dpi=1000)