Plot multiple columns of Pandas DataFrame using Seaborn

To plot multiple columns of Pandas DataFrame using Seaborn, we can take the following steps −

  • Make a dataframe using Pandas.

  • Plot a bar using Seaborn's barplot() method.

  • Rotate the xticks label by 45 angle.

  • To display the figure, use show() method.


import pandas
import matplotlib.pylab as plt
import seaborn as sns
import numpy as np
plt.rcParams["figure.figsize"] = [7.00, 3.50]
plt.rcParams["figure.autolayout"] = True
df = pandas.DataFrame({"X-Axis": [np.random.randint(10) for i in range(10)], "YAxis": [i for i in range(10)]})
bar_plot = sns.barplot(x='X-Axis', y='Y-Axis', data=df)