DevelopmentNov 16, 2026By Rivalivo Editorial

Python plotting libraries in 2026: Matplotlib vs Plotly.py vs Bokeh vs Altair vs plotnine

Compare Matplotlib, Plotly.py, Bokeh, Altair and plotnine for static figures, interactive browser charts and repeatable Python reports.

Small blue and green scatter, line and bar charts on layered ivory cards.

A Python chart can be an image in a journal article, an interactive exhibit on a website or a small application that makes another query when someone changes a filter. The five libraries here overlap while you are exploring data in a notebook. Their differences become clearer when you hand the result to someone else and they need to open, print, review or regenerate it.

Start with the artifact your audience will receive. If the deliverable is a journal-ready vector figure, check font, panel dimensions and reproducible export first. If it needs hover and selection, determine whether those interactions can use data already embedded in a page. If selections trigger Python code or fetch restricted data, budget for a running service. These are distinct requirements even if the chart on screen initially looks the same.

The quick difference

Product Best fit What you get What to check
Matplotlib Precisely composed static figures Explicit control over figures, axes and output backends Configure fonts, sizing and a reproducible render environment
Plotly.py Interactive figures and fast exploration Plotly Express and browser-native chart interactions Static exports require Kaleido and compatible Chrome or Chromium
Bokeh Browser charts that may need live Python Standalone documents and Python callbacks via a server Decide which interactions require hosting
Altair Declarative statistical graphics Vega-Lite encodings and chart composition Watch inline data size; aggregate or change the data transformer
plotnine Recurring statistical plots with shared styles Layered grammar with facets, scales and themes Test static export and review expected ggplot-style differences

Matplotlib

Matplotlib is a practical choice when the figure itself is the deliverable. Its Figure and Axes model lets you place and style each panel, while its backends support screen display and file formats appropriate to different contexts. For a report with a small set of plots, explicit control over spacing, labels and axes helps keep a fixed design as underlying numbers change.

That control also means you must decide which parts of figure construction to standardize. Create a style and an export size before adjusting individual charts by hand. Use explicit Figure and Axes objects for multi-panel reports so changes apply to the intended panel. The open source library does not require a rendering subscription. The cost is maintaining the environment, including fonts and a backend that works when the job runs without a desktop.

Plotly.py

Plotly.py is useful when readers will hover over points, zoom into a period or show and hide series. Plotly Express packages common charts behind a relatively short interface and returns a figure you can customize. It is a good place to start for an analyst publishing an interactive chart without writing front-end chart code. Plan the hover content deliberately: it can communicate values that do not fit in permanent labels.

If you also need PDF, SVG or PNG output, build that path separately. Plotly’s documentation describes Kaleido and the requirement for a compatible Chrome or Chromium installation in current Kaleido versions. Test an export where the scheduled job will run, not only on the analyst’s laptop. Plotly.py itself is open source; any separately selected chart hosting or application service needs its own budget. Be careful about data included in every shareable figure.

Bokeh

Bokeh gives teams a choice between a standalone browser document and a Bokeh application connected to a server. The first is suitable for interactions that can run on the client with the data already provided. The second can synchronize browser state with Python code. A useful deciding example is a filter that queries a large table rather than choosing among values already included in the page.

When planning a Bokeh server application, account for session behavior, data access and operations. The documentation explains how the application creates documents for connected browsers, which makes it worthwhile to measure how much memory a representative session uses. Simpler standalone charts avoid that service cost but have to ship the necessary client-side data. Bokeh is open source, so infrastructure and support are separate from library licensing.

Altair

Altair lets you describe a chart through its data, marks and encodings. It is a good match for statistical questions where the team wants to change which variable is mapped to position, color or a facet while preserving the rest of the chart specification. It is also a natural way to review a chart in code: a colleague can see what each channel represents without tracing a sequence of drawing commands.

Altair’s large dataset guide explains the default inline row limit and options such as VegaFusion. Do not push an entire source table into the chart just to avoid making a data decision. Choose aggregation, a sampled view, an appropriate data transformer or another delivery path based on what the viewer needs. The open source library has no per-chart charge. The surrounding environment and any external data hosting are separate decisions.

plotnine

plotnine uses a layered grammar that will be familiar to many users of R’s ggplot2. It is helpful when a group of static reports should share facets, scales, themes and statistical transformations. The same design idea can be reused across reports without each author manually choosing positions for axes and annotations. Start by porting one representative chart and reviewing it beside the original at final display size.

The project documents file export and display. Treat migration as a comparison of outputs rather than a search and replace: a label, default scale or font can change how a plot reads even if the code is idiomatic in both libraries. The library is open source. Plan for font availability, consistent data ordering and dependency versions when renders become part of a regular reporting pipeline. If your audience needs live browser exploration, assess that separately.

Choose by how the chart is delivered

For a paper or printed report, establish the expected format, width and typography before comparing libraries. Try a dense figure with long labels. Inspect a vector export in the tool that will place it in the publication. For a recurring internal report, see whether a second person can adjust the data and regenerate all figures with the same scale and color conventions.

For browser output, decide what the reader can do and where the underlying data will live. Hover and zoom are often possible without a Python server. Live access to a database and interactions that call Python need an operational design. Review file size, embedded data, slow-device behavior and accessibility. An interactive chart also benefits from a short descriptive caption and an alternative data table when readers cannot use the visual interaction.

If most of the time goes into transforming the data before it reaches the chart, compare Python DataFrame libraries as a separate dependency choice.

Run a chart handoff trial

  • Create a plot at the actual publication size, including the longest labels and a missing value.
  • Open the chart with the same browser or document software your audience uses. Check whether interaction depends on a live connection.
  • Check the export job on the machine that will run it. Record fonts, browser dependencies and file size.
  • Have another analyst rerun the chart and explain its encodings. Confirm what data ships to readers.

Which option fits your needs?

Use Matplotlib for precise static figures, or plotnine when a layered statistical grammar helps standardize them. Use Plotly.py for quick interactive figures, Altair for declarative encodings, and Bokeh when browser interactions may need to connect to a running Python service. The most useful trial ends with the file or page someone else will actually receive.

References