Bokeh is a Python library used for creating interactive visualizations in a web browser. It provides powerful tools that offer flexibility, interactivity, and scalability for exploring various data insights.
Bokeh is a vast library that offers a variety of plots, graphs, and charts to create a variety of visuals. Different visual diagrams can be created to represent the statistical information of datasets. Following are a few from the wide range of statistical visuals created through Bokeh:
Ease of use: Creates common plots, as well as custom and complex plots based on the requirements.
Shareable: Shares visual data easily that can also be rendered.
Integratable: Interacts with other popular Pydata tools very easily, e.g., with Pandas and NumPy.
Interactive: Creates interactive plots that show a dynamic display based on the specified requirements, e.g., graph and color sliders.
Open source: Bokeh is an open-source project that the new developer can access.
Bokeh is an easy-to-set-up library if the Python setup is already done on the visual studio code. We use pip to install packages, so first install the pip package manager.
sudo apt-get -y install python3-pip
Once the pip package manager is installed, install the bokeh library.
pip install bokeh
This will automatically download all the other libraries required to execute the Bokeh programs. The compatible version of many frequently used libraries is installed.
Once the library is installed, import its modules to access their attributes and functionalities. For example, to create customized visuals, we can import plotting
and models
.
from bokeh.plotting import figure, showfrom bokeh.models import ColumnDataSource
Once the code is complete, write the simple Python call in the terminal to execute the code. In this case, main.py
is the file that contains a bokeh program.
python3 main.py
It allows exporting plots in different file formats such as PNG, SVG, and PDF.
It provides themes and styling options to customize the appearance of plots according to the required aesthetics.
It supports interactive panning and zooming on geographic plots to create interactive maps.
It offers a high-level API for the quick creation of a common plot with minimal code and a low-level API for more flexibility for advanced customization.
It generates JavaScript-based plots that can be displayed and easily shared in web browsers.
Bokeh is a vast visual library to explore. Install it in the Python setup and explore the plots and charts created through it to understand better how it works.
Free Resources