I have a dataframe of volume by country for two specific years. I would like to visualize how those countries change their rank from one year to another. I would like to know if it's possible with matplotlib or seaborn to connect those barplots by phisycally drawing a line outlining the change of rank.
Something like this:
Base data and code:
import seaborn as sns
import pandas as pd
import matplotlib.pyplot as plt
d = {'volume' : [1000, 500, 200, 100, 350, 600], 'year' : [2017, 2017, 2017, 2018, 2018, 2018], 'country' : ['US', 'UK', 'France', 'US', 'UK', 'France']}
df = pd.DataFrame(data=d)
fix, axs = plt.subplots(ncols=2)
sns.barplot(x='volume',y='country', data=df[df['year']==2017].sort_values(by='volume', ascending = False), ax=axs[0])
sns.barplot(x='volume',y='country', data=df[df['year']==2018].sort_values(by='volume', ascending = False), ax=axs[1])
plt.show()