I am new in data visualization. I am practicing Seaborn and I am trying to plot a barplot with this dataframe. I want the chart has 3 bars on each symbol, however, the output has only 1 bar on each symbol. May I know how to fix it?
Part of the DataFrame...
returns_7d returns_30d returns_ytd
symbol
TDOC -0.210839 -17.712095 -3.922423
EXAS -4.649067 -6.439275 -1.415680
PACB -2.953760 11.886232 37.815711
REGN 0.465364 5.803325 -0.629814
TWST 6.707956 3.619967 10.4043
The code like this:
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
# Change the style of the figure to the "dark" theme
sns.set_style("darkgrid")
plt.figure(figsize=(12,6))
plt.title('YTD Returns')
sns.barplot(x=returns_all.index,y=returns_all['returns_7d'],color='b',edgecolor='w',label='returns_7d')
sns.barplot(x=returns_all.index,y=returns_all['returns_30d'],color='r',edgecolor='w',label='returns_30d')
sns.barplot(x=returns_all.index,y=returns_all['returns_ytd'],color='g',edgecolor='w',label='returns_ytd')
plt.xlabel('symbol', fontsize=11)
plt.ylabel('%', fontsize=11)
plt.xticks(rotation = 90)
plt.legend()
plt.show()
Output like this: