๐Ÿ“ฃ Announcing Plotly.py 5.7.0 - Text on Histograms and Heatmaps, Patterns on areas, Plotly.js version number access, Smith charts

Update: version 5.8.0 was released since this was posted.

Iโ€™m happy to announce that Plotly.py 5.7.0 is now available for download via pip and conda! For up-to-date installation and upgrading instructions please see our Getting Started documentation page and if you run into trouble, check out our Troubleshooting Guide.

This is a combined announcement for versions 5.3.0 through 5.7.0. Check out the full changelog or scroll down for the highlights.

:abcd: Easy Text on Histograms, Heatmaps and more with text_auto

Itโ€™s now trivial to display the Y value as text on bar charts and histograms, or the Z value on heatmaps with px.imshow() or on 2d histograms, using Plotly Expressโ€™ new text_auto argument. This is one less reason to use the deprecated create_annotated_heatmap figure factory, and one more reason to use px.imshow() instead!

import plotly.express as px

df = px.data.medals_wide(indexed=True)
fig = px.imshow(df, text_auto=True)
fig.show()

:checkered_flag: Pattern fills on Area charts

Area charts now support pattern fills (aka texture or hachure) for greater accessibilty or low-color rendering such as for print. This feature was implemented by Github user @s417-lama and we thank them on behalf of the community!

import plotly.express as px
df = px.data.medals_long()

fig = px.area(df, x="medal", y="count", color="nation",
             pattern_shape="nation", pattern_shape_sequence=[".", "x", "+"])
fig.show()

:straight_ruler: Skip tick labels with ticklabelstep

By default, cartesian axes will render with one tick label per gridline, but you can now render fewer tick labels using the layout.xaxis.ticklabelstep attribute (and this works on the yaxis also of course, as in the example below!).

import plotly.express as px
df = px.data.iris()

fig = px.scatter(df, x="sepal_width", y="sepal_length", facet_col="species")
fig.update_yaxes(ticklabelstep=2)

fig.show()

This feature was anonymously sponsored :heart_decoration:.

:radio: Smith Charts

You can now make Smith Charts with Plotly! A Smith Chart is a specialized chart for visualizing complex numbers: numbers with both a real and imaginary part.

import plotly.graph_objects as go
fig = go.Figure(go.Scattersmith(imag=[0.5, 1, 2, 3], real=[0.5, 1, 2, 3]))
fig.show()

:scroll: Controlling legend groups with legend.groupclick

By default, clicking on legend items for traces in the same group toggles the visibility of the entire group. You can now set this to toggling individual items with the layout.legend.groupclick attribute.

This feature was anonymously sponsored :heart_decoration:.

:1234: Easy access to your Plotly.js version number

A common problem while debugging Plotly figures, especially when using Dash, is making sure that the underlying version of Plotly.js supports the features youโ€™re trying to use. You can now see the exact version of Plotly.js (not Plotly.py!) that is rendering your chart by mousing over the logo in the modebar in the top-right corner of figures. If you donโ€™t see the version number, then the version is below 2.9.0.

:heart: Powered by Plotly.js 2.11.1 and perfect for Dash 2.3.1

The version of Plotly.js that Plotly.py 5.7.0 is built on is the same one thatโ€™s bundled with the recently-released Dash 2.3.1 so we recommend that if youโ€™re a Dash user you upgrade to Dash 2.3.1, to get the full benefit of all of these libraries working together.

:package: Get it now!

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

:reminder_ribbon: In Case You Missed It: Previous Announcements

  • Plotly.py 5.2
    • Trendlines
    • ECDF Plots
    • Markers on Lines
    • Sharper WebGL
  • Plotly.py 5.1
    • Legend Group Titles
  • Plotly.py 5.0
    • A combined, federated JupyterLab Extension
    • Bar Chart Patterns (aka Hatching or Textures)
    • Icicle and Flame Charts
    • Explicit Legend-Item Ordering
    • Faster JSON serialization with orjson
  • Plotly.py 4.14
    • Faceted and Animated Images and Heatmaps with px.imshow()
    • Inside Tick Labels
    • Smarter Axis Auto-Typing Behaviour
  • Plotly.py 4.13
    • Magical error messages
    • Performance improvements (including for Dash!)
    • Faceted Maps
  • Plotly.py 4.12:
    • Horizontal and vertical lines and rectangles
  • Plotly.py 4.11:
    • Period positioning on date axes
  • Plotly.py 4.10:
    • date -axis and px.timeline() improvements
    • Full Figures for Development
    • A Faster px.imshow()
5 Likes

awesome to see these improvements to make more and cleaner charts faster! Iโ€™m a huge fan of pattern fills for giving multiple data encoding methods in charts (e.g. color + pattern). I used to dip into using matplotlib more for patterns so I will definitely give this a go with just px.area! +1 for accessibility! :100: extra thanks to @s417-lama

2 Likes