Bokeh परिचय
Bokeh वेब ब्राउज़र के लिए इंटरैक्टिव डेटा विज़ुअलाइज़ेशन लाइब्रेरी है। यह HTML/JS आउटपुट उत्पन्न करता है जिसे ब्राउज़र में देखा जा सकता है।
1. लाइन प्लॉट
from bokeh.io import show from bokeh.plotting import figure p = figure(plot_width=300, plot_height=300, title="Line Plot") p.line([2, 1, 2, 4], [1, 3, 5, 4], line_width=2, color="blue", legend_label="Data") show(p) # ब्राउज़र में खोलता है
2. सर्कल (स्कैटर) प्लॉट
from bokeh.io import show
from bokeh.plotting import figure
p = figure(plot_width=400, plot_height=300, title="Scatter Plot")
p.circle([2, 1.5, 2, 3, 2.4], [2, 3, 4, 4, 3],
size=10, color="red", alpha=0.8, legend_label="Points")
show(p)
3. बार चार्ट (वर्टिकल बार)
from bokeh.io import show
from bokeh.plotting import figure
sales_qty = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri']
p = figure(x_range=sales_qty, plot_height=250, title="Sales Figures",
toolbar_location=None, tools="")
p.vbar(x=sales_qty, top=[6, 3, 4, 2, 4], width=0.4, color="steelblue")
# स्टाइलिंग
p.xgrid.grid_line_color = None
p.y_range.start = 0
p.xaxis.axis_label = "Weekday"
p.yaxis.axis_label = "Sales"
show(p)
आउटपुट
प्रत्येक show(p) एक नया ब्राउज़र टैब खोलता है जिसमें इंटरैक्टिव प्लॉट होता है (पैन, ज़ूम, सेव, रीसेट टूल्स के साथ)।

Bokeh स्थापना
pip install bokeh
उन्नत विशेषताएं
- इंटरैक्टिविटी: होवर टूल, टैप टूल, लिंक्ड प्लॉट्स।
- लेआउट:
row(),column(),gridplot()। - डेटा स्रोत:
ColumnDataSourceसे डायनामिक अपडेट। - सर्वर:
bokeh serveसे रियल-टाइम स्ट्रीमिंग।