Bokeh 2.3.3

Run this script:

source = ColumnDataSource(data= 'date': dates, 'price': prices, 'volume': volume, 'moving_avg': pd.Series(prices).rolling(10).mean() ) p = figure( title="Stock Price with Moving Average", x_axis_type="datetime", width=800, height=400, tools="pan,wheel_zoom,box_zoom,reset,save" ) Line glyphs p.line('date', 'price', source=source, legend_label="Price", color="navy", alpha=0.7) p.line('date', 'moving_avg', source=source, legend_label="10-day MA", color="firebrick", line_width=2) Circles for hover points circles = p.circle('date', 'price', source=source, size=4, color="navy", alpha=0.3) Configure HoverTool (fixed in 2.3.3) hover = HoverTool(renderers=[circles], tooltips=[ ("Date", "@date%F"), ("Price", "@price0.00"), ("Volume", "@volume0,0") ], formatters="@date": "datetime") p.add_tools(hover) DataTable to show raw values columns = [ TableColumn(field="date", title="Date", formatter="datetime"), TableColumn(field="price", title="Price ($)"), TableColumn(field="volume", title="Volume") ] data_table = DataTable(source=source, columns=columns, width=400, height=400) Layout layout = row(column(p, width=850), data_table) Output and show output_file("bokeh233_stock_demo.html") show(layout) bokeh 2.3.3

# stock_viewer.py from bokeh.plotting import figure, show from bokeh.models import ColumnDataSource, HoverTool, DataTable, TableColumn from bokeh.layouts import column, row from bokeh.io import output_file import pandas as pd import numpy as np dates = pd.date_range('2023-01-01', periods=200) prices = 100 + np.cumsum(np.random.randn(200).cumsum()) volume = np.random.randint(1000, 10000, 200) python stock_viewer

In the fast-evolving world of data science, it's easy to get caught up in the latest releases, beta features, and breaking changes. However, seasoned developers and data engineers know the immense value of a stable, well-tested release. Enter Bokeh 2.3.3 —a version that, while not the absolute newest, represents a golden standard for reliability, performance, and production-ready interactive visualization. Here are common ones and how to solve them: 1

python stock_viewer.py You will see a fully interactive HTML document open in your browser. Notice how the hover tool works reliably, the table updates smoothly, and the WebGL backend (if you had thousands more points) would handle it gracefully—all thanks to the refinements of Bokeh 2.3.3. Even with a stable release, users occasionally encounter issues. Here are common ones and how to solve them: 1. " RuntimeError: Models must be owned by only a single document " This occurs when you reuse the same figure or ColumnDataSource in two different layouts. Fix : Create a new source for each independent document, or use bokeh.io.curdoc() to manage ownership properly (for server apps). 2. Large JSON output for plots Bokeh 2.3.3 can generate huge .html files if you embed millions of points. Solution : Enable WebGL for scatter plots ( p.scatter(..., webgl=True) ) or use CDSView with filters. 3. Missing fonts or tooltip styling Some users complain that hover tooltips show ??? for special characters. Fix : Explicitly set a css_classes property and define font-family in your own CSS file. Migration Considerations: 2.3.3 vs. Bokeh 3.x If you're starting a new project today, should you use Bokeh 2.3.3 or jump to Bokeh 3.4+? Here’s a decision matrix:

| Feature / Consideration | Bokeh 2.3.3 | Bokeh 3.x+ | |-------------------------------|--------------------------------------------------|------------------------------------------------| | | 3.6 – 3.9 (3.10 experimental) | 3.8 – 3.11+ | | API stability | Frozen, no changes | Evolving (removals up to 3.4) | | New features | No | Yes (e.g., Vega themes, better TypeScript) | | Long-term support | Community, no official LTS | Active development | | Legacy code compatibility | Excellent | May require refactoring (layouts, tools) | | Security patches | No new patches | Regular |