✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

📣 Plotly.js 2.0 is coming soon!

After 5 years and 177 releases of Plotly.js between 1.0.0 and the current 1.58.4, it’s finally time for us to release Plotly.js 2.0! :tada:

Our commitment to semantic versioning requires us to make this next release a major version bump because we are making some backwards-incompatible changes to older and deprecated features (see below), but we see this as a low-risk maintenance release and we expect that the vast majority of users should plan to upgrade without fearing significant issues, including Javascript developers who embed Plotly.js directly in their apps or websites, as well as data scientists using Plotly.js via Plotly.py in a notebook environment, and of course Dash app developers!

We encourage all interested developers to read the changelog carefully, but here is a summary of the important changes and some commentary.

:warning: What is getting changed or removed?

We take stability and backwards-compatibility very seriously, so although in principle a new major version could introduce numerous breaking changes, we are bumping the major version number in Plotly.js only because we are removing the following functionality, which we feel is very seldom-used, has long been deprecated and/or has long been un/undocumented. We are making these changes today so as to be able to continue maintaining the library without needing to invest in upkeep of legacy/unused functionality.

We are dropping:

  • Support for Internet Explorer 9 and 10: our support for these browsers has been poor and degrading for months, and we’re officially ruling out supporting them at all starting now. For reference, Microsoft stopped supporting IE 10 more than 5 years ago.
  • The contourgl trace type: this trace type is not currently in the main bundle, and this removal will only impact users of the gl2d custom bundle. This trace has many problems and is easily replaced by using the non-WebGL-powered contour trace.
  • The area trace type: this trace type has been marked as deprecated and un/under-documented for years; the barpolar trace types should be used instead.
  • The legacy polar r and t attributes of the otherwise-cartesian scatter and bar traces: these attributes have been marked as deprecated and un/under-documented for years; the scatterpolar and barpolar trace types should be used instead.
  • The Plotly.plot() function: this function has been deprecated/under-documented for years, in favour of Plotly.react() or a combination of Plotly.newPlot()/Plotly.restyle()/Plotly.relayout()
  • The Plotly.d3 object: this object currently mirrors all of version 3 of the D3 library. Version 4 of D3 came out over 4 years ago (the current latest version is 6.5!) and the state of Javascript packaging has evolved such that it’s now much easier for Javascript developers to “bring their own” version of d3 to their app rather than rely on the one provided by Plotly.js.
  • We are marking the heatmapgl and pointcloud trace types as “deprecated”, and recommending that folks use the heatmap/image or scattergl trace types instead. These will be removed in a future major version, such as Plotly.js 3.0. If you are using these, please reach out and tell us why and how, so we can take your needs into consideration as we move forward!

:hammer_and_wrench: What is getting upgraded or added?

Since this is mostly a maintenance/cleanup release for us, intended to allow us to move faster in the future, this particular version intentionally does not include many new features.

The one major improvement to the library we have made is that a number of our partial bundles now no longer use function constructors, and therefore do not trigger the corresponding Content Security Policy error. The bundles that are now function-constructor safe are: basic , cartesian , finance , geo , and mapbox. We are committing to making this a permanent change. We have also added a new partial bundle called strict, which contains the maximal subset of the library that works without using function constructors, and as we are able to refactor the rest of the functionality of Plotly.js to avoid using function constructors we will expand this partial bundle. This security-related work was generously sponsored by Equinor, and we sincerely thank them for their vision and support. :heart:

Note: we also still need more sponsorship in order to finish this work and extend this CSP-safety to all of our 3d trace types!

:snake: What about Plotly.py?

Since the plotly.graph_objects module in Plotly.py is automatically generated from Plotly.js, the removals of trace types and attributes listed above force us to change the major version number in Plotly.py as well, to 5.0. No other backwards-incompatible changes are planned in Plotly.py, although we will be announcing some new features shortly. We will, however, be marking a number of under-documented/under-used portions of the library as deprecated, so as to permit future removals, and we will be declaring Python 2.7 and 3.5 and below to be discouraged/deprecated as well. Version 6.0 of Plotly.py will no longer work with these older versions of Python.

:dancer: What about Dash?

Dash depends on Plotly.js via the dcc.Graph component from dash_core_components, although we don’t consider the portions of the Plotly.js schema that were deprecated before Dash was released to be part of the public Dash API. An upcoming minor version of dash_core_components will be upgraded to use Plotly.js 2.0, meaning Dash users will get the new version of Plotly.js via a routine upgrade of the dash package, which depends on dash_core_components.

You can control the exact version of Plotly.js which dcc.Graph loads by placing a specific Plotly.js/ version bundle into your Dash app assets directory. The same approach allows you to choose a specific partial bundle to use, for example if your app uses only a subset of Plotly.js features, or if your organization policies require to use the new strict bundle to avoid Content Security Policy warnings. We are also working on a new mechanism for developers to easily build their own custom partial bundles, for cases where the officially-supported partial bundles are either too big or too small.

:spider_web: What about the CDN?

We host Plotly.js bundles on a Content Delivery Network for folks to use, and we will continue to do so with v2, but in order to not break anything for folks using the “latest” bundle URL at https://cdn.plot.ly/plotly-latest.min.js, we will stop updating that bundle (it will stay pinned to 1.58.4) and the new “latest” CDN URL will be https://cdn.plot.ly/plotly-latest-v2.js (once 2.0.0 comes out). The same pattern will hold true for all the official partial bundles.

:rocket: Try the first Release Candidate and give us feedback!

We’ve released Plotly.js 2.0.0-rc.0 to NPM and to the CDN under https://cdn.plot.ly/plotly-2.0.0-rc.0.min.js for folks to try out and give us feedback. You can try these bundles right now in your Dash app using the assets directory approach outlined above.

Please let us know if there’s anything in these bundles that would prevent you from upgrading or otherwise break your app and we’ll try to either undo the change if it’s not listed above or provide an easy glide path!

9 Likes

What about react-plotly?

Good question! react-plotly.js should be unaffected by this change: you should be able to upgrade your version of Plotly.js to 2.0 and continue using react-plotly.js just like previous minor version bumps :slight_smile: If you want to try the RC in your app you can confirm this and let us know if you run into any problems!

Thanks Nicolas

I sure will try version 2 with react-plotly and get back to you in case I run into any problems.