Update: new post on version 5.13.0 was released since this was posted.
Iโm happy to announce that Plotly.py 5.8.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.
Whatโs new in Plotly.py 5.8
Our changelog has links to individual pull requests, but here are the highlights:
Better Autocompletions with Type Hints
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.
Minor Ticks
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 !
Powered by Plotly.js 2.12.1 and perfect for Dash 2.4
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.
Get it now!
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!
In Case You Missed It: Previous Announcements
- Plotly.py 5.7
- Patterns on areas
- Plotly.py 5.6
- Tick label steps
- Plotly.py 5.5
- Text on histograms and heatmaps
- Plotly.py 5.4
- Smith charts
- Plotly.py 5.3
- Legend group click
- 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