
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- 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 Bokeh be used to create step line plot in Python?
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.
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
The βstepβ function present in glyph function is used to generate discrete data points.
Example
from bokeh.plotting import figure, output_file, show output_file("stepLine.html") p = figure(plot_width=500, plot_height=300) p.step([2, 5, 3, 6, 7,9], [6,3, 2, 1, 0, 5], line_width=2, mode="center") show(p)
Output
Explanation
The required packages are imported, and aliased.
The figure function is called along with plot width and height.
The βoutput_fileβ function is called to mention the name of the html file that will be generated.
The βstepβ function present in Bokeh is called, along with data.
It helps render the steps.
The βshowβ function is used to display the plot.