Plotly Horizontal Bar Chart

In this Plotly tutorial, you will learn how to plot a horizontal bar chart in Python. To plot bar chart horizontally use the parameter orientation.

# Import Plotly Module
import plotly.express as px

# Import Dataset
dataset = px.data.gapminder().query("continent=='Oceania'")

# Horizontal Bar Chart
plot = px.bar(dataset, x="pop", y="country", orientation="h", title='Plotly Horizontal Bar Chart', height=400, width=800)

# Show the Plot
plot.show()

Output:

Plotly Horizontal Bar Chart

Free learning resources: AiHintsCodeAllow

Leave a Comment

Your email address will not be published.