unable to recreate pandas's bar plot in seaborn
Question:
I can easily create the bar plot in pandas as below:
import pandas as pd
revenue = [100, 110, 105, 120, 95]
profit = [35, 50, 45, 65, 30]
quarter = ['Q2/22', 'Q1/22', 'Q4/21', 'Q3/21', 'Q2/21']
df = pd.DataFrame({'Revenue': revenue, 'Profit': profit}, index=quarter)
df.plot(kind='bar')
when I try to plot the same df in seaborn it gives me different graph:
import seaborn as sns
sns.barplot(data=df)
i tried melting the df but the results are the same
Answers:
I can easily create the bar plot in pandas as below:
import pandas as pd
revenue = [100, 110, 105, 120, 95]
profit = [35, 50, 45, 65, 30]
quarter = ['Q2/22', 'Q1/22', 'Q4/21', 'Q3/21', 'Q2/21']
df = pd.DataFrame({'Revenue': revenue, 'Profit': profit}, index=quarter)
df.plot(kind='bar')
when I try to plot the same df in seaborn it gives me different graph:
import seaborn as sns
sns.barplot(data=df)
i tried melting the df but the results are the same