Hi I have two columns in a table, say 'A' and 'B'. I am trying to make a ridge plot with 'A' aggregated into 20 bins of 'B', I understand, one option is to bin the values first and then plot it, but in that case the x-axis would be that of A, but I want the x-axis of the ridge plots to be marked by 'B'-ie the bins.
Something similar to the attaches, coded in Matlab (the figure with Population in y axis and NO2 in y axis)- but I would prefer a similar plot for multiple time-slices- therefore a ridge plot.
I could make a ridge plot with a single column in the table
df = pd.read_csv('/div/users/mes/x.csv')
stab=df[df['Var1'].str.contains('CHN|IND|USA|IDN|PAK|NGA|BRA|BGD|RUS|MEX|JPN|ETH|PHL|EGY|COD')]
cat_month = CategoricalDtype(
['CHN', 'IND', 'USA', 'IDN', 'PAK', 'NGA',
'BRA', 'BGD', 'RUS', 'MEX','JPN','ETH','PHL','EGY','COD']
)
stab['Var1'] = stab['Var1'].astype(cat_month)
stab.dtypes
plt.figure(dpi=380)
fig, ax = joyplot(
data=stab[['A1','A2','A3', 'B','Var1']],
by='Var1',
column=['A1','A2','A3'],
color=[ '#282828', '#FFD700','#0000EE'],
legend=True,
alpha=0.5,ylim='own',
figsize=(11, 19)
)
# for a in ax[: -1]:
# a.set_xlim([0,10])
ax[-1].set_xticks([ 0,2,4,6,8,10 ])
ax[-1].set_xticklabels(['0','2','4','6','8','10'],fontsize=18)
plt.xlabel('Vulnerability Index', fontsize=18)
plt.rc("font", size=18)
ax[-1].legend(fontsize=16)
plt.title('SSP5', fontsize=20)
plt.show()