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
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.
What’s new in Plotly.py 4.9
Our changelog has details and links to individual pull requests, but here are the highlights:
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
pipinstallation 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
- 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
yum, and without relying on
Xvfbas a headless X11 Server.
Hosted notebook service compatibility: Kaleido can be used in just about any online notebook service that permits the use of
pipto install the
kaleidopackage. 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") fig.write_image("fig.png")
This will produce a file named
fig.png in the current working directory containing this image
Kaleido can be installed using
$ pip install kaleido
$ 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.
Plotly Express Gantt charts with
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.
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.
Hexbin Tile Maps with
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
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
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:
- If you want to use wide-form input but not color by the wide variable, you can now set
- Our Pandas backend now supports all Plotly Express 2d Cartesian function names as inputs to
df.plot(kind=<kind>), including those not supported by Pandas’ default backend like
px.imshow()now reads Pandas index names for labelling, just like the other wide-form-supporting functions
- Less-restrictive type-checking: wide-form support for mixtures of
- Automatic setting of
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
In Case You Missed It: Previous 4.x Announcements
- Plotly Express Support for Wide- and Mixed-Form Data
- a Pandas backend
- Major performance improvments
- unified hover labels
- excluding weekends from time-series axes
- legend titles
- GeoJSON choropleth improvements
- a new sunburst/treemap
- new Plotly Express functions for pie charts, sunbursts, treemaps, funnels maps,
px.imshowfor heatmaps and full-color images
- facet wrapping in Plotly Express,
- Plotly Express input enhancements to work without data frames
- Mapbox maps without Mapbox tokens
- Choropleth and Density mapbox maps
- Indicators (big numbers, gauges, bullet charts)
Plotly.py 4.0 :
- displayable anywhere