Changes in Version 7 in Python

Guide to changes in version 7 of Plotly.py and how to migrate from version 6


Plotly Studio: Transform any dataset into an interactive data application in minutes with AI. Try Plotly Studio now.

This page outlines the changes in Plotly.py version 7 and cases where you may need to update your charts or the tools you use for working with Plotly.py.

Version 7 upgrades the bundled Plotly.js from version 3 to version 4, so it includes the Plotly.js changes as well as the Plotly.py ones. Most figures render without any changes. The sections below cover the cases where you need to update your code.

Removed Traces

The Mapbox-based traces were deprecated in version 6 and have been removed in version 7. Use the MapLibre-based traces instead, which have the same attributes.

Removed Use instead
go.Scattermapbox go.Scattermap
go.Choroplethmapbox go.Choroplethmap
go.Densitymapbox go.Densitymap
px.scatter_mapbox px.scatter_map
px.line_mapbox px.line_map
px.choropleth_mapbox px.choropleth_map
px.density_mapbox px.density_map
In [1]:
import plotly.graph_objects as go

fig = go.Figure(go.Scattermap(
    lon=[-73.57, -79.38, -123.12],
    lat=[45.50, 43.65, 49.28],
    mode="markers",
    marker=dict(size=12),
))

fig.show()

See Migrate to MapLibre for the full list of changes when moving from the Mapbox traces.

Removed Attributes

layout.mapbox

The mapbox subplot has been removed. Use layout.map, which takes the same attributes. In Plotly Express, mapbox_style becomes map_style.

stream

The stream attribute has been removed from all traces. It configured the Chart Studio streaming service, which is no longer available.

*src attributes

Attributes ending in src (xsrc, ysrc, textsrc, marker.colorsrc, and so on) have been removed, along with layout.hidesources. They referenced data sources in Chart Studio.

Chart Studio configuration options

The showLink, link_text, sendData, showSources, and showEditInChartStudio configuration options have been removed. To let users share a chart, use showSendToCloud, which is enabled by default in version 7 and adds a "Share chart…" button to the mode bar.

Removed Figure Factories

The deprecated figure factories create_2d_density, create_annotated_heatmap, create_bullet, create_candlestick, create_choropleth, create_distplot, create_facet_grid, create_gantt, create_hexbin_mapbox, create_ohlc, create_scatterplotmatrix, and create_violin have been removed. Figure Factories lists the recommended alternative for each one.

Static Image Export

Support for Kaleido versions earlier than 1.0.0 has been removed, along with support for Orca. The engine argument has been removed from fig.write_image(), fig.to_image(), pio.write_image(), pio.write_images(), pio.to_image(), pio.full_figure_for_development(), and from renderer constructors. See Static Image Export.

Changed Defaults

Maps fit to your data

geo subplots (used by go.Scattergeo and go.Choropleth) now fit their initial view to the locations they plot: layout.geo.fitbounds defaults to "locations" instead of False. Tile-based map subplots do the same, through a new layout.map.fitbounds attribute that also defaults to "locations".

Figures that already set a view render unchanged. To get the previous world view, set fitbounds=False:

In [2]:
import plotly.graph_objects as go

fig = go.Figure(go.Choropleth(locations=["CAN", "MEX"], z=[1,