plotly v4.8.0 Release Notes

Release Date: 2020-05-26 // almost 4 years ago
  • ๐Ÿ“š Key new documentation pages:

    โž• Added

    • plotly now provides a Plotly Express-backed Pandas-compatible plotting backend, which can be activated via pandas.options.plotting.backend = "plotly". Note that it is not intended to implement every Pandas plotting function, nor is it intended to replicate the behaviour of every argument, although per the changes below, x and y should behave similarly. (#2336)
    • New datasets have been added to plotly.express.data: stocks, experiment, medals_wide and medals_long. (#2336)
    • plotly go.Figure and go.FigureWidget now have a _repr_html_ and a _repr_mimebundle_ method, which are standard hooks for integration in systems based on IPython. In particular, with _repr_html_ plotly figures can now be used within sphinx-gallery without any scraper. These additions should not change anything to the way plotly figures are displayed in notebook environments, since the _ipython_display_ method (already present in earlier versions) takes precedence over the new methods.

    โšก๏ธ Updated

    • The behaviour of the x, y, orientation, histfunc, violinmode, boxmode and stripmode arguments for 2d-cartesian functions in Plotly Express (i.e. scatter, line, area, bar, histogram, violin, box, strip, funnel, density_heatmap and density_contour) has been refined (#2336):
      • wide-form data support: if either x or y (but not both) may now be provided as a list of column references into data_frame or columns of data, in which case the imputed data frame will be treated as "wide" data and melt()ed internally before applying the usual mapping rules, with function-specific defaults.
      • if neither x nor y is provided but data_frame is, the data frame will be treated as "wide" with defaults depending on the value of orientation (and orientation has accordingly been added to scatter, line, density_heatmap, and density_contour for this purpose). Previously this would have resulted in an empty figure.
      • if x or y is missing, it is inferred to be the index of data_frame if data_frame provided, otherwise a stable index of integers starting at 0. In the case of px.bar, if the provided value is not continuous, the missing value is treated as a column of 1s named "count", so as to behave more like px.histogram and to avoid sizing the resulting bars differently based on their position in the column. Previously, missing values defaulted to integers starting at 0 per trace which made it potentially inconsistent or misleading.
      • if x (y) is missing, orientation now defaults to v (h). Previously it always defaulted to v but this is not considered a breaking change, as the cases in which it now defaults to h caused unreadable output if set to v.
      • if both x and y are provided and one of them does not contain continuous values, orientation defaults to the value perpendicular to that axis. Previously it always defaulted to v but this is not considered a breaking change, as the cases in which it now defaults to h caused unreadable output if set to v.
      • if both x and y are provided to histogram, and if x, y and z are provided to density_heatmap or density_contour, then histfunc now defaults to sum so as to avoid ignoring the provided data, and to cause histogram and bar to behave more similarly.
      • violinmode, boxmode and stripmode now default to overlay if x (y) in in v (h) orientation is also mapped to color, to avoid strange spacing issues with the previous default of group in all cases.
    • The Plotly Express arguments color_discrete_map, symbol_map and line_dash_map now accept the string "identity" which causes the corresponding input data to be used as-is rather than mapped into color_discrete_sequence, symbol_sequence or line_dash_sequence, respectively. (#2336)
    • Plotly Express now accepts px.Constant or px.Range objects in the place of column references so as to express constant or increasing integer values. (#2336)