- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can bar graphs be visualized using Bokeh?
Bokeh is a Python package that helps in data visualization. It is an open source project. Bokeh renders its plot using HTML and JavaScript. This indicates that it is useful while working with web-based dashboards.
Bokeh can be easily used in conjunction with NumPy, Pandas, and other Python packages. It can be used to produce interactive plots, dashboards, and so on.
Matplotlib and Seaborn produce static plots, whereas Bokeh produces interactive plots. This means when the user interacts with these plots, they change accordingly.
Plots can be embedded as output of Flask or Django enabled web applications. Jupyter notebook can also be used to render these plots.
Dependencies of Bokeh −
Numpy Pillow Jinja2 Packaging Pyyaml Six Tornado Python−dateutil
Installation of Bokeh on Windows command prompt
pip3 install bokeh
Installation of Bokeh on Anaconda prompt
conda install bokeh
Let us see an example −
from bokeh.plotting import figure, output_file, show xvals = ['label_1', 'label_2', 'label_3'] yvals = [56, 78, 99] fig = figure(x_range = xvals, plot_width = 400, plot_height = 300) fig.vbar(x = xvals, top = yvals, width = 0.5) show(fig)
Output
Explanation
The required packages are imported, and aliased.
The figure function is called along with plot width and height.
The data is defined in lists.
The ‘output_file’ function is called to mention the name of the html file that will be generated.
The ‘vbar’ function present in Bokeh is called, along with data.
The ‘show’ function is used to display the plot.
- Related Articles
- How can a vertical bar graph be visualized using Bokeh and Python?
- How can a Beizer curve be visualized using Bokeh?
- How can multiple lines be visualized using Bokeh Python?
- How can axis aligned rectangles be visualized using Python and Bokeh?
- How can patch plot with multiple patches be visualized in Bokeh?
- How can Bokeh library be used to plot horizontal bar plots using Python?
- How can Bokeh library be used to generate line graphs in Python?
- How can Bokeh be used to visualize bar plot in Python?
- Explain how Pygal can be used to create interactive visualizations, and show how a bar graph can be visualized using Pygal.
- How can Bokeh be used to visualize multiple bar plots in Python?
- How can Bokeh library be used to visualize stacked bar charts in Python?
- How can a linear relationship be visualized using Seaborn in Python?
- Displaying bar graphs using Matplotlib
- How can Bokeh be used to generate scatter plot using Python?
- How can glyph curves with different legends be shown using Bokeh?
