WeirdGeek

Data Science | Machine Learning | Automation

  • Data Analytics
  • Python
  • Data Science
  • Google Apps Script
  • Machine Learning
  • Artificial Intelligence
  • SQL Server

03/05/2020 By WeirdGeek Leave a Comment

Plotting horizontal bar graph using Plotly using Python

In our previous post we have seen how we can create vertical bar graph using Plotly library in Python. Here in this post we will see how we can plot horizontal bar graph using Plotly library.

For a data analyst it important that they get hands on experience on all important libraries that will help them to visualize the data in better way.

 

Here’s the below code for plotting the horizontal bar graph using Plotly:

We have imported

import pandas as pd
import plotly.express as px
Data = pd.read_excel(r"C:\Users\WeirdGeek\Desktop\WG_Test.xlsx")
Data.head()

Plotting hrizontal bar graph using Plotly using Python

The above is the sample data that we are going to use for plotting out horizontal bar graph.

Below is the code that will plot the horizontal bar chart in plotly.

fig = px.bar(Data, x='Marks', y="Name", orientation='h')
fig.show() 

The above code will plot the chart i.e marks on x axis and Name on y axis. the important parameter is orientation = “h” which will plot the chart in horizontal mode.

Plotting horizontal bar graph

To get more detailed knowledge about types of Charts, you can check the official Plotly website. Also if you want to explore more codes/posts related to same topic on our website, then you can find it here.

If you have any questions or if you need any help please get in touch with me using the comment section below.

Related posts:

  1. Plot stacked bar chart using plotly in Python
  2. Plot 100 percent stacked column chart using plotly in Python
  3. Plotting vertical bar graph using Plotly using Python
  4. Plot multiple bar graph using Python’s Plotly library

Filed Under: Data Science Tagged With: Data Visualization, Plotly, Python

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Subscribe to my Blog !!

Enter your email below to subscribe my blog and get the latest post right in your inbox.

  • Home
  • Terms
  • Privacy
  • Contact Us

Copyright © 2025 · WeirdGeek · All trademarks mentioned are the property of their respective owners.