Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Bokeh
  • Matplotlib
  • Pandas
  • Seaborn
  • Ggplot
  • Plotly
  • Altair
  • Networkx
  • Machine Learning Math
  • Machin Learning
  • Data Analysis
  • Deep Learning
  • Deep Learning Projects
  • NLP
  • Computer vision
  • Data science
  • Machin Learning Interview question
  • Deep learning interview question
Open In App
Next Article:
Python Bokeh - Plotting Vertical Bar Graphs
Next article icon

Python Bokeh – Plotting Horizontal Bar Graphs

Last Updated : 03 Jul, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report

Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity.

Bokeh can be used to plot horizontal bar graphs. Plotting horizontal bar graphs can be done using the hbar() method of the plotting module.

plotting.figure.hbar()

Syntax : hbar(parameters)

Parameters :

  • y : y-coordinates of the center of the horizontal bars
  • height : thickness of the horizontal bars
  • right : x-coordinates of the right edges
  • left : x-coordinates of the left edges, default is 0
  • fill_alpha : fill alpha value of the horizontal bars
  • fill_color : fill color value of the horizontal bars
  • hatch_alpha : hatch alpha value of the horizontal bars, default is 1
  • hatch_color : hatch color value of the horizontal bars, default is black
  • hatch_extra : hatch extra value of the horizontal bars
  • hatch_pattern : hatch pattern value of the horizontal bars
  • hatch_scale : hatch scale value of the horizontal bars, default is 12
  • hatch_weight : hatch weight value of the horizontal bars, default is 1
  • line_alpha : percentage value of line alpha, default is 1
  • line_cap : value of line cap for the line, default is butt
  • line_color : color of the line, default is black
  • line_dash : value of line dash such as :
    • solid
    • dashed
    • dotted
    • dotdash
    • dashdot

    default is solid

  • line_dash_offset : value of line dash offset, default is 0
  • line_join : value of line join, default in bevel
  • line_width : value of the width of the line, default is 1
  • name : user-supplied name for the model
  • tags : user-supplied values for the model

Other Parameters :

  • alpha : sets all alpha keyword arguments at once
  • color : sets all color keyword arguments at once
  • legend_field : name of a column in the data source that should be used
  • legend_group : name of a column in the data source that should be used
  • legend_label : labels the legend entry
  • muted : determines whether the glyph should be rendered as muted or not, default is False
  • name : optional user-supplied name to attach to the renderer
  • source : user-supplied data source
  • view : view for filtering the data source
  • visible : determines whether the glyph should be rendered or not, default is True
  • x_range_name : name of an extra range to use for mapping x-coordinates
  • y_range_name : name of an extra range to use for mapping y-coordinates
  • level : specifies the render level order for this glyph

Returns : an object of class GlyphRenderer

Example 1 :In this example we will be using the default values for plotting the graph.




# importing the modules
from bokeh.plotting import figure, output_file, show
  
# file to save the model
output_file("gfg.html")
      
# instantiating the figure object
graph = figure(title = "Bokeh Horizontal Bar Graph")
  
# y-coordinates to be plotted
y = [1, 2, 3, 4, 5]
  
# x-coordinates of the right edges
right = [1, 2, 3, 4, 5]
  
# height / thickness of the bars 
height = 0.5
  
# plotting the graph
graph.hbar(y,
           right = right,
           height = height)
  
# displaying the model
show(graph)
 
 

Output :

Example 2 :In this example we will be plotting horizontal bars with different parameters.




# importing the modules
from bokeh.plotting import figure, output_file, show
  
# file to save the model
output_file("gfg.html")
      
# instantiating the figure object
graph = figure(title = "Bokeh Horizontal Bar Graph")
  
# name of the x-axis
graph.xaxis.axis_label = "x-axis"
      
# name of the y-axis
graph.yaxis.axis_label = "y-axis"
  
# y-coordinates to be plotted
y = [1, 2, 3, 4, 5]
  
# x-coordinates of the right edges
right = [1, 2, 3, 4, 5]
  
# height / thickness of the bars 
height = [0.5, 0.4, 0.3, 0.2, 0.1]
  
# color values of the bars
fill_color = ["yellow", "pink", "blue", "green", "purple"]
  
# plotting the graph
graph.hbar(y,
           right = right,
           height = height,
           fill_color = fill_color)
  
# displaying the model
show(graph)
 
 

Output :



Next Article
Python Bokeh - Plotting Vertical Bar Graphs

Y

Yash_R
Improve
Article Tags :
  • AI-ML-DS
  • Data Visualization
  • AI-ML-DS With Python
  • Python Bokeh-plotting-figure-class
  • Python-Bokeh

Similar Reads

  • Python Bokeh tutorial - Interactive Data Visualization with Bokeh
    Python Bokeh is a Data Visualization library that provides interactive charts and plots. Bokeh renders its plots using HTML and JavaScript that uses modern web browsers for presenting elegant, concise construction of novel graphics with high-level interactivity.  Features of Bokeh: Flexibility: Boke
    15+ min read
  • Getting started With Bokeh

    • Introduction to Bokeh in Python
      Bokeh is a Python interactive data visualization. Unlike Matplotlib and Seaborn, Bokeh renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Features of Bokeh: Some o
      1 min read

    • How to Install Python Bokeh Library on Windows?
      There are different types of data visualization modules in Python like Matplotlib, Seaborn, or Plotly among them Bokeh module is one which is used to capsulate information or data in the form of graphs and charts which are embedded in flask and Django applications. This module is also used for makin
      2 min read

    • How to Install Bokeh in Python3 on MacOS?
      Data visualization is the graphical representation of information and data with the help of charts and graphs. There are different types of well-known data visualization libraries like Matplotlib, Seaborn or Plotly for presenting information and data in the form of charts and graphs. Bokeh is also a
      2 min read

    • Python - Setting up the Bokeh Environment
      Bokeh is supported on CPython versions 3.6+ only both with Standard distribution and Anaconda distribution. Other Python versions or implementations may or may not function. Current version of Bokeh is 2.0.2 . Bokeh package has the following dependencies: 1. Required Dependencies PyYAML>=3.10pyth
      1 min read

    Plotting Different Types of Plots

    • Python Bokeh - Plotting Vertical Bar Graphs
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity.Bokeh can be used to plot vertical bar graphs. Plotting vert
      4 min read

    • Python Bokeh - Plotting a Scatter Plot on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot a scatter plot on a graph. Plotti
      2 min read

    • Python Bokeh - Plotting Patches on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot patches on a graph. Plotting patc
      2 min read

    • Make an area plot in Python using Bokeh
      Bokeh is a Python interactive data visualization. Unlike Matplotlib and Seaborn, Bokeh renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Plotting the Area Plots A
      2 min read

    • Python Bokeh - Making a Pie Chart
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Let us see how to plot a pie chart in Bokeh. Does not provi
      3 min read

    Annotations and Legends

    • Python Bokeh - Making Interactive Legends
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. How to make Interactive legends? The legend of a graph refl
      2 min read

    • Bokeh - Annotations and Legends
      Prerequisites: Bokeh Bokeh includes several types of annotations to allow users to add supplemental information to their visualizations. Annotations are used to add notes or more information about a topic. Annotations can be titles, legends, Arrows, bands, labels etc. Adding legends to your figures
      2 min read

    Creating Diffrent Shapes

    • Python Bokeh - Plotting Ovals on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot ovals on a graph. Plotting ovals
      4 min read

    • Python Bokeh - Plotting Triangles on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot triangles on a graph. Plotting tr
      2 min read

    • Python Bokeh - Plotting Multiple Polygons on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity.Bokeh can be used to plot multiple polygons on a graph. Plot
      3 min read

    • Python Bokeh - Plotting Rectangles on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot rectangles on a graph. Plotting r
      2 min read

    Plotting Multiple Plots

    • Bokeh - Vertical layout of plots
      Bokeh includes several layout options for arranging plots and widgets. They make it possible to arrange multiple components to create interactive data applications. The layout functions helps build a grid of plots and widgets. It supports nesting of as many rows, columns, or grids of plots together
      2 min read

    • Bokeh - Horizontal layout of plots
      Bokeh includes several layout options for arranging plots and widgets. They make it possible to arrange multiple components to create interactive dashboards or data applications. The layout functions let you build a grid of plots and widgets. You can nest as many rows, columns, or grids of plots tog
      2 min read

    • Bokeh - grid layout of plots
      Bokeh includes several layout options for arranging plots and widgets. They make it possible to arrange multiple components to create interactive dashboards or data applications. The layout functions let you build a grid of plots and widgets. You can nest as many rows, columns, or grids of plots tog
      5 min read

    Functions in Bokeh

    • bokeh.plotting.figure.cross() function in Python
      Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, HTML, and server. Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with de
      2 min read

    • bokeh.plotting.figure.diamond_cross() function in Python
      Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like a notebook, HTML and server. Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with d
      2 min read

    • bokeh.plotting.figure.step() function in Python
      Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, html and server. The Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with
      4 min read

    • bokeh.plotting.figure.circle_cross() function in Python
      Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, html and server. The Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with
      4 min read

    • bokeh.plotting.figure.annular_wedge() function in Python
      Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, html and server. The Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with
      4 min read

    • bokeh.plotting.figure.arc() function in Python
      Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, html and server. The Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with
      4 min read

    • bokeh.plotting.figure.asterisk() function in Python
      Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, html and server. The Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with
      4 min read

    • bokeh.plotting.figure.bezier() function in Python
      Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, html and server. The Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with
      4 min read

    • bokeh.plotting.figure.circle_x() function in Python
      Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, html and server. The Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with
      4 min read

    • bokeh.plotting.figure.circle() function in Python
      Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, html and server. The Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with
      4 min read

    • bokeh.plotting.figure.annulus() function in Python
      Bokeh is a data visualization library in Python that provides high-performance interactive charts and plots and the output can be obtained in various mediums like notebook, html and server. The Figure Class create a new Figure for plotting. It is a subclass of Plot that simplifies plot creation with
      4 min read

    Interactive Data Visualization

    • Configuring Plot Tooltips in Bokeh
      Bokeh is a powerful data visualization library in Python that allows you to create interactive and visually appealing plots. The Bokeh plotting module provides several tools that can be used to enhance the functionality of the plots. These tools can be configured to suit your specific needs. In this
      4 min read

    • Bokeh - Adding Widgets
      Bokeh is a Python data visualization library for creating interactive charts & plots. It helps us in making beautiful graphs from simple plots to dashboards. Using this library, we can create javascript-generated visualization without writing any scripts. What is a widget? Widgets are interactiv
      11 min read

    Graph

    • Python Bokeh - Plotting a Line Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot a line graph. Plotting a line gra
      4 min read

    • Python Bokeh - Plotting Multiple Lines on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot multiple lines on a graph. Plotti
      3 min read

    • Python Bokeh - Plotting Horizontal Bar Graphs
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot horizontal bar graphs. Plotting h
      4 min read

    • Python Bokeh - Plotting Vertical Bar Graphs
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity.Bokeh can be used to plot vertical bar graphs. Plotting vert
      4 min read

    • Python Bokeh - Plotting a Scatter Plot on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot a scatter plot on a graph. Plotti
      2 min read

    • Python Bokeh - Plotting Patches on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot patches on a graph. Plotting patc
      2 min read

    • Make an area plot in Python using Bokeh
      Bokeh is a Python interactive data visualization. Unlike Matplotlib and Seaborn, Bokeh renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Plotting the Area Plots A
      2 min read

    • Python Bokeh - Plotting Wedges on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot wedges on a graph. Plotting wedge
      3 min read

    • Python Bokeh - Making a Pie Chart
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Let us see how to plot a pie chart in Bokeh. Does not provi
      3 min read

    • Python Bokeh - Plotting Triangles on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot triangles on a graph. Plotting tr
      2 min read

    • Python Bokeh - Plotting Ovals on a Graph
      Bokeh is a Python interactive data visualization. It renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Bokeh can be used to plot ovals on a graph. Plotting ovals
      4 min read

    Building Advanced Visualizations with Glyphs

    • Glyphs in Bokeh
      Bokeh is a library of Python which is used to create interactive data visualizations. In this article, we will discuss glyphs in Bokeh. But at first let's see how to install Bokeh in Python. Installation To install this type the below command in the terminal. conda install bokeh Or pip install bokeh
      6 min read

    • Create a plot with Multiple Glyphs using Python Bokeh
      In this article, we will be learning about multiple glyphs and also about adding a legend in bokeh. Now bokeh provides us with a variety of glyphs that can be used to represent a point in a plot. Some glyphs are circle, square, asterik, inverted_triangle(), triangle() etc. Installation This module d
      7 min read

    • Make an Circle Glyphs in Python using Bokeh
      Bokeh is a Python interactive data visualization. Unlike Matplotlib and Seaborn, Bokeh renders its plots using HTML and JavaScript. It targets modern web browsers for presentation providing elegant, concise construction of novel graphics with high-performance interactivity. Plotting the Circle Glyph
      4 min read

geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences