I am trying to make a boxplot of an 18 year record of monthly rainfall and flood frequency. i.e. each x tick is the month, and each x tick is associated with two boxplots, one of the rainfall and one of the flood frequency. So far I have managed to plot these using seaborn (see following code and image), however I do not know how to create the boxplot with two y axes, which I need because the scales for each variable differ.
The data looks like this (largest value of flood_freq in the dataset is 7, not shown here):
Group Rainfall Flood_freq
0 Jan 115.679997 0
1 Jan 72.929999 0
2 Jan 39.719999 0
3 Jan 46.799999 1
4 Jan 54.989998 0
...
212 Dec 51.599998 0
213 Dec 45.359999 0
214 Dec 10.260000 0
215 Dec 52.709998 0
This is the code I have used:
dd=pd.melt(FBPdf,id_vars=['Group'],value_vars=['Rainfall','Flood_freq'],var_name='Data')
sns.boxplot(x='Group',y='value',data=dd,hue='Data')
Which results in this:
I have since looked on the seaborn documentation and it seems it does not permit 2 y axes (Seaborn boxplot with 2 y-axes). Is anyone able to offer potential alternatives for what I am trying to achieve? The solutions on the link above do not relate to this double-y-axis and grouped boxplot problem I have.
Thank you very much in advance!