Black Lives Matter. Please consider donating to Black Girls Code today.

📣 Announcing Plotly.py 4.6

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

I’m pleased to announce that Plotly.py 4.6 is now available for download via pip and conda! For up-to-date installation 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.6

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

Unified Hover Labels

Until today, depending on the hovermode, hovering on data resulted in either one hoverlabel on the closest point to the cursor, or one hoverlabel per point at the same x- or y-coordinate as the cursor. This release introduces two new values for layout.hovermode, namely "x unified" and "y unified", which results in a single hover label that refers to multiple points at a single X or Y value (on 2D cartesian subplots). Here’s what this looks like:

image

Check out our expanded Hover Label documentation page for more examples of how to control and customize hover labels and spike lines.

This feature was anonymously sponsored and we thank our benefactor on behalf of the community :heart:.

Excluding Weekends and Holidays from Date Axes

A long-requested feature has been to add the ability to remove certain time periods from charts with date axes, for example removing weekends from charts that detail business processes or financial transactions. This is now implemented for date axes using the new rangebreaks attribute (but unfortunately does not work with the scattergl trace type yet).

image

Using rangebreaks you can exclude weekends with bounds=["sat", "mon"] and individual dates with values=["2020-01-01", "2020-01-12"]. Check out our reworked Time Series and Date Axes documentation page for information on how to use this feature.

This feature was anonymously sponsored and we thank our benefactor on behalf of the community :heart:.

Labeling with px.imshow() plus xarray support

With this release, it’s now possible to pass tick label data to px.imshow() and to control the x, y, and color axis titles. These labels are also automatically used for the hover label text.

image

The xarray package is designed to make it easy to work with labelled N dimensional matrix data, and with this release, if you pass an xarray object into px.imshow() now, these labels are automatically set based on the label information in the xarray.

image

This is perfect for using Plotly Express with Datashader, as Datashader returns xarray objects by default.

Documentation Rebranding and New Search Functionality

As you browse our documentation today, you might notice the fresh new colors and fonts, as well as the switch from the old plot.ly domain name to the new plotly.com domain name. We love our new branding and hope that you do too!

image

This refresh is not just skin-deep, though: we’ve also reworked our documentation search system. The search box is now available on every page, in the left-hand sidebar, and search queries are now run against both the tutorial examples and the Figure Reference page, to make sure you can quickly find what you’re looking for! We’ve also tuned the Figure Reference search result ordering, to ensure the most useful hits show up higher in the rankings.

image

Community

We’ve updated our contributing notes and pull-request template to make it easier for community members to pitch in with Plotly.py.

We also heartily thank the community members who contributed to our code and documentation in this release: thank you @SylwiaOliwia2 and @dangercrow and @tvaucher!

Even if you cannot contribute to Plotly.py yourself, if you work with an organization that uses Plotly.py and has a software budget, one of the best ways to give back to the open-source community is to sponsor a feature in any of our libraries!

Powered by Plotly.js 1.53 and perfect for Dash 1.10

This release of Plotly.py inherits all of the improvements to the underlying Javascript library that powers it. The full Plotly.js 1.53 changelog contains more details about what changed under the hood.

The version of Plotly.js that Plotly.py 4.6 is built on is the same one that’s bundled with the recently-released Dash 1.10 so we recommend that if you’re a Dash user you upgrade to both Dash 1.10 and Plotly.py 4.6 to get the full benefit of all of these libraries working together.

Get it now!

To sum up: Plotly.py 4.6.0 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!

Previous Announcements in the 4.x series

3 Likes

Hi @nicolaskruchten,

There is something buggy going on with my subplots using x unified

When creating the plot on its own, the hoverlabel is fine, but when I put it inside a dcc.Graph component, the labels don’t show. I created two versions in chart studio, one that is exported from the dash app and the second created using the chart_studio module.

The latter works fine, but the former works initially, but then all but the last plot’s hover labels no longer work when the window is resized.

Any idea what is going on here?

Created using dash app via dcc.Graph: https://chart-studio.plotly.com/~mbkupfer/72/#/

Created using chart_studio (works good): https://chart-studio.plotly.com/~mbkupfer/70/#plot

That is quite curious! Could you please file a Github issue for us to follow up? https://github.com/plotly/plotly.py/issues/new

cc @archmoj

Thanks for looking into this! I have uploaded it here: https://github.com/plotly/plotly.py/issues/2609

Switching shared_xaxes to False fixed this issue. My current workaround is to no longer use shared axes and make the other two invisible. Hopefully that helps your team dial in on the underlying issue though.