I’m happy to announce that Plotly.py 5.8.0 is now available for download via
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.
Our changelog has links to individual pull requests, but here are the highlights:
Thanks to a community pull request, our lazy imports no longer interfere with type checkers and we can now add type hints throughout
plotly.graph_objects and we started by type-hinting all the methods which return
Figure objects so your editor can give you nice autocompletion hints as you code, even as you chain methods together:
We’ve also added type hints to Plotly Express, so you can type
fig = px.bar(...) and then get completions from typing
fig.<tab> in your favourite editor.
Most editors should be able to use these hints to give you nice autocompletion, including Jupyter Notebook and Lab (where they work best if you use a language server, for example with
jupyterlab-lsp) or in VSCode or PyCharm.
Cartesian axes now support
minor ticks and gridlines:
import plotly.express as px df = px.data.tips() fig = px.scatter(df, x="total_bill", y="tip", color="sex") fig.update_xaxes(minor_ticks="outside", minor_showgrid=True) fig.update_yaxes(minor_ticks="outside", minor_showgrid=True)
This lets you do some interesting things, for example having major ticks/grids on month boundaries and minor ones on week boundaries (the example below also shows off our new
griddash parameter for dashed gridlines) and this looks really great with the tick labels set to
period mode so that the month labels below are centered on the month they denote:
import pandas as pd import plotly.express as px df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv') df = df.loc[(df["Date"] >= "2016-07-01") & (df["Date"] <= "2016-12-01")] fig = px.line(df, x='Date', y='AAPL.High') fig.update_xaxes(ticks= "outside", ticklabelmode= "period", tickcolor= "black", ticklen=10, minor=dict(ticklen=4, dtick=7*24*60*60*1000, tick0="2016-07-03", griddash='dot', gridcolor='white') )
This feature was anonymously sponsored, so thanks to our sponsor !
The version of Plotly.js that Plotly.py 5.8.0 is built on is the same one that’s bundled with the just-released Dash 2.4 so we recommend that if you’re a Dash user you upgrade to Dash 2.4, to get the full benefit of all of these libraries working together.
To sum up: Plotly.py 5.8.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!
- Patterns on areas
- Tick label steps
- Text on histograms and heatmaps
- Smith charts
- Legend group click
- ECDF Plots
- Markers on Lines
- Sharper WebGL
- Legend Group Titles
- A combined, federated JupyterLab Extension
- Bar Chart Patterns (aka Hatching or Textures)
- Icicle and Flame Charts
- Explicit Legend-Item Ordering
- Faster JSON serialization with