Data Visualization (plotly, bokeh, altair) Tutorial
Learn Data Visualization (plotly, bokeh, altair) step by step: 31 lessons in 8 chapters with examples, quizzes, diagrams and projects.
Start learning →
of lessons completed
Getting Started
- Interactive Data Visualization: The Big Picture Learn what interactive charts are, how Plotly, Bokeh and Altair differ, how they render in a browser, and how to choose a library for your project.
- How a Chart Works Inside See how every chart turns data into marks, scales, axes and visual encodings, and build a small SVG bar chart and scatter plot by hand.
- Choosing the Right Chart Pick the right chart for your question: comparison, trend, distribution, relationship or composition. Avoid misleading axes with a runnable Python stand-in.
Plotly
- Plotly Express Basics Draw line, bar and scatter charts from a pandas DataFrame with Plotly Express, and see the figure JSON behind them with a runnable Python stand-in.
- Plotly Figures: Data, Layout and Traces Understand a Plotly figure as plain JSON: traces, layout and config, graph_objects versus Express, update_layout and add_trace, with a Python validator.
- Plotly Styling, Templates and Annotations Style Plotly charts: titles, axes, color scales, templates and dark mode, hover templates, annotations, shapes and subplots, with runnable JavaScript stand-ins.
- Statistical Charts in Plotly Build histograms, box plots, violins, density heatmaps, trendlines, marginal plots and error bars in Plotly, and see how the numbers behind them are computed.
- Plotly.js in the Browser Use Plotly.js directly in the browser: load it from a CDN, call newPlot, update with react and extendTraces, handle click, hover and relayout events.
- Dashboards with Dash and Callbacks Build a Plotly Dash app: a layout of components, callbacks as reactive functions, State, multiple outputs, and how to deploy it, with a runnable callback-graph model.
Bokeh
- Bokeh Fundamentals Learn Bokeh basics: create a figure, draw line, scatter and vbar glyphs, share data with ColumnDataSource, save to HTML, and see how the JSON document model works.
- Bokeh Tools, Hover and Widgets Add pan, zoom and selection tools to Bokeh charts, build HoverTool tooltips, connect sliders and dropdowns with CustomJS, and link views with a shared source.
- Bokeh Server and Streaming Data Run Bokeh apps with bokeh serve, use curdoc and Python callbacks, stream live data with stream() and patch(), and keep a rolling window with rollover.
Altair and Vega-Lite
- Altair and the Grammar of Graphics Learn how Altair describes charts declaratively: Chart, mark and encode, the four data types Q, N, O and T, and the Vega-Lite spec every chart turns into.
- Reading and Writing Vega-Lite JSON Learn the structure of a Vega-Lite specification: data, mark, encoding, transform and scale. Read any Altair chart as JSON and embed it with vega-embed.
- Altair Transforms and Aggregation Learn Altair and Vega-Lite transforms: filter, calculate, aggregate, bin, window and fold. Compare the spec with plain Python code that does the same work.
- Layering, Faceting and Concatenation Combine Altair charts with layer, hconcat, vconcat, facet and repeat. Learn how scales and axes are shared or independent and how small multiples work.
- Selections and Interactive Altair Charts Make Altair charts interactive with selection_interval, selection_point, bindings, conditions, linked views and tooltips, and see how selections are just predicates.
Data Preparation and Design
- Preparing Data: Tidy Format and Reshaping Prepare data for Plotly, Bokeh and Altair: wide versus long tables, pandas melt and pivot, clean column types and a plan for missing values before you chart.
- Time Series, Maps and Other Special Charts Learn when and how to draw date axes, range sliders, candlesticks, choropleth maps, treemaps, sunbursts and Sankey diagrams, and prepare the data with pandas.
- Color, Labels and Accessibility Choose sequential, diverging and categorical palettes, test contrast and color-blind safety, and make Plotly, Bokeh and Altair charts readable for everyone.
- Storytelling with Charts Turn a correct chart into a clear one: write message titles, annotate, cut clutter, use small multiples with shared scales, and lay out dashboards well.
Production and Performance
- Large Datasets and Performance Keep interactive charts fast with millions of rows: WebGL, canvas versus SVG, LTTB downsampling, server-side binning and Datashader-style aggregation.
- Exporting, Embedding and Sharing Charts Save interactive charts as HTML, export PNG, SVG and PDF, embed in Jupyter, Streamlit and websites, and handle CSP and offline use safely.
- Testing Charts and Common Pitfalls Test chart specs instead of pixels, snapshot figure JSON, and avoid truncated bars, dual axes, overplotting and version drift in Plotly, Bokeh and Altair.
Projects
- Project: Sales Dashboard Build a small sales dashboard step by step: tidy the data, compute KPI cards, draw a bar and a line chart, add a region filter and lay it all out on one page.
- Project: Trend Explorer with Linked Views Build a trend explorer: smooth noisy time series with rolling averages, draw small multiples, and link a brush on the time axis to a summary chart.
- Project: Stock Price Candlestick Chart Build a candlestick chart from OHLC data: compute moving averages in Python, add a volume subplot, and zoom with a range slider in an SVG stand-in.
- Project: Survey Results Report Turn Likert survey answers into an honest report: tally responses, draw diverging stacked bars, compare groups with uncertainty and keep the page accessible.
Practice and Review
- Practice Exercises with Solutions Twelve data visualization exercises with runnable solutions: build chart specs, aggregate, bin, reshape, smooth, write scales, check contrast and pick a library.
- Data Visualization Interview Questions Prepare for data visualization interviews: grammar of graphics, Plotly vs Bokeh vs Altair, performance, misleading charts, dashboards and accessibility.
- Plotly, Bokeh and Altair Cheat Sheet One page with the same bar, line, scatter and histogram chart written in Plotly, Bokeh and Altair, plus a chart-choice table and a library picker.