📣 Announcing Plotly.py 4.9 - Kaleido for static image export, Hexbin Tile Maps, and Timelines

Update: version 4.10 has been released since this was posted.

I’m pleased to announce that Plotly.py 4.9 is now available for download via pip and conda! For up-to-date installation and upgrading instructions (including the extra required steps for JupyterLab!) please see our Getting Started documentation page and if you run into trouble, check out our Troubleshooting Guide.

:newspaper: What’s new in Plotly.py 4.9

Our changelog has details and links to individual pull requests, but here are the highlights:

:tada: Kaleido: Static image export with zero dependencies

Alongside plotly.py 4.9, we’re excited to announce the release of Kaleido, a new project that enables the generation of static images (e.g. PNG, SVG, etc.) from plotly.py figures, by Plotly’s Chief Scientist @jmmease.

Kaleido is our new recommended system for exporting Plotly figures to static images: we encourage all users of Orca to upgrade to Plotly 4.9+ and to install Kaleido!

Kaleido versus Orca

  • pip installation support: Pre-compiled wheels for 64-bit Linux, MacOS, and Windows are available on PyPI and can be installed using pip. As with Orca, Kaleido can also be installed using conda.
  • Improved startup time and resource usage: Kaleido starts up about twice as fast as Orca, and uses about half as much system memory.
  • Docker compatibility: Kaleido can operate inside docker containers based on Ubuntu 14.04+ or Centos 7+ (or most any other Linux distro released after ~2014) without the need to install additional dependencies using apt or yum, and without relying on Xvfb as a headless X11 Server.
  • Hosted notebook service compatibility: Kaleido can be used in just about any online notebook service that permits the use of pip to install the kaleido package. These include Colab, Sagemaker, Azure Notebooks, Databricks, Kaggle, etc. In addition, Kaleido is compatible with the default Docker image used by Binder.
  • Security policy / Firewall compatibility: There were occasionally situations where strict security policies and/or firewall services would block Orca’s ability to bind to a local port. Kaleido does not have this limitation since it does not use ports for communication.
  • Downsides or Limitations: none that we can think of!

Using Kaleido for image export

When Kaleido is installed, plotly.py 4.9.0+ will automatically use it for image export operations, falling back to Orca if Kaleido is not available. For example…

import plotly.express as px
df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species")

This will produce a file named fig.png in the current working directory containing this image

Kaleido can be installed using pip

$ pip install kaleido

or conda.

$ conda install -c plotly python-kaleido

Out of the box, Kaleido supports converting Plotly figures to PNG, JPG, WebP, SVG, and PDF output formats. As with Orca, support for the EPS format is available when the poppler library is installed. This can be done either using conda, or a system package manager.

If you’re interested to learn more about the motivation for Kaleido and how it works, check out our new Medium post: Introducing Kaleido or the Github repo.

:calendar: Plotly Express Gantt charts with px.timeline()

We are deprecating the create_gantt() figure factory and replacing it with a new Plotly Express function px.timeline() which does all the same things and more, using all the same keyword arguments and patterns from every other Plotly Express function, including faceting, continuous and discrete coloring, and PX styling including order control. Check out our new Gantt Chart documentation for details.


Note: px.timeline() produces bar traces, which is possible because we’ve fixed a long-standing bug in Plotly whereby bar values on date axes were interpreted in a locale-dependent way when using base. This is no longer the case, so you can make the kind of chart above by setting base as dates, and x as a number of milliseconds. px.bar() now also supports a new base keyword argument.

:diamond_shape_with_a_dot_inside: Hexbin Tile Maps with ff.create_hexbin_mapbox()

Community member @RenaudLN has contributed an excellent new Figure Factory to Plotly for creating Hexbin Tile Maps! Thank you @RenaudLN and bravo for what was essentially a perfect pull request from the get-go :bowing_man:


:straight_ruler: Plotly Express facet_row_spacing and facet_col_spacing

A common concern when using Plotly Express’ faceting support with many rows or many columns or for very big or very small figures is the hardcoded spacing between facets. This is also a problem when activating the X and Y tick labels on all facets, not just the outside ones, or when using larger or smaller fonts. As of this release, this spacing can be controlled with facet_col_spacing and facet_row_spacing.


:triangular_ruler: Improvements to Plotly Express wide-form support

Since the 4.8 release added support for wide-form data input to Plotly Express functions, we’ve received lots of positive feedback and some requests for improvements, some of which we released in 4.8.1 and 4.8.2, and some of which are coming out today in 4.9.0:

:package: Get it now!

To sum up: Plotly.py 4.9 is out and if you’re excited about any of the above features, head on over to our Getting Started documentation page for full installation instructions, and don’t forget to upgrade your JupyterLab extensions if that is your environment of choice! And of course, don’t forget to install Kaleido :slight_smile:

:reminder_ribbon: In Case You Missed It: Previous 4.x Announcements

  • Plotly.py 4.8:
    • Plotly Express Support for Wide- and Mixed-Form Data
    • a Pandas backend
  • Plotly.py 4.7:
    • Major performance improvments
    • Shape-drawing
  • Plotly.py 4.6:
    • unified hover labels
    • excluding weekends from time-series axes
    • imshow labelling and xarray support
  • Plotly.py 4.5:
    • legend titles
    • GeoJSON choropleth improvements
    • a new sunburst/treemap path API
    • uniformtext
  • Plotly.py 4.4:
    • new Plotly Express functions for pie charts, sunbursts, treemaps, funnels maps,
  • Plotly.py 4.3:
    • px.imshow for heatmaps and full-color images
    • facet wrapping in Plotly Express,
  • Plotly.py 4.2:
    • Treemaps
    • Plotly Express input enhancements to work without data frames
    • texttemplate everywhere
  • Plotly.py 4.1:
    • Mapbox maps without Mapbox tokens
    • Choropleth and Density mapbox maps
    • Indicators (big numbers, gauges, bullet charts)
  • Plotly.py 4.0 :
    • offline-only
    • plotly.express-first
    • displayable anywhere

Kaleido! :trophy: :trophy: :trophy:
We’ve been trying to make static image generation of interactive plots easy & scalable since 2014, with Kaleido I think we’ve finally built a winner!


Kaleido is huge news for us. In the past, it has been a struggle to get our reporting system to run on serverless architectures. We basically use the following workflow:

  • We render a HTML page using jinja templates.
  • We embed plotly graphs as SVGs in this HTML page.
  • We then run Weasyprint (absolutely brillant project) to generate a PDF from the HTML.

The second step was hard for us to port to Azure Functions since we relied on an Orca instance to run at all times (bundling Orca within the Docker container that we use for the Function App has proven to be very hard and we abandoned our efforts to get it running).

Kaleido means that the same workflow can now run on a single serverless instance. Thank you so much to all the awesome people involved! Truly a game changer.