How to plot horizontal bar graph in Seaborn

You can plot the horizontal bar graph in Seaborn with the following code. The given example helps you to understand how to make a horizontal bar graph in Python using Seaborn. I highly recommend you “Python Crash Course Book” to learn Python.

# Import the required libraries
import seaborn as sns
import matplotlib.pyplot as plt

# Load the Dataset
dataset = sns.load_dataset("iris")

# Draw Horizontal Bar Graph
sns.barplot(x="petal_width", y="species", data=dataset)

# Display the plot
plt.show()

Output:

Leave a Comment

Your email address will not be published.