Skip to content

Commit 51911a4

Browse files
committed
merge: branch 'main' into codegen2
2 parents d339c7b + 53c4770 commit 51911a4

39 files changed

+443
-546
lines changed

Diff for: .circleci/config.yml

+128-209
Large diffs are not rendered by default.

Diff for: CHANGELOG.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5-
## [6.0.1] - 2025-02-16
5+
## [6.0.1] - 2025-03-14
6+
7+
### Updated
8+
- Updated Plotly.js from version 3.0.0 to version 3.0.1. See the [plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#301----2025-02-18) for more information.
9+
610

711
### Fixed
8-
- Fix `TypeError` when using `orjson` to serialize `pandas.NA`.
12+
- Fix `TypeError` when using `orjson` to serialize `pandas.NA` [[#5040](https://github.com/plotly/plotly.py/pull/5040)].
13+
- Fix issue where using `category_orders` on `px.pie` raised `ColumnNotFoundError` [[#5000](https://github.com/plotly/plotly.py/pull/5000)].
14+
- Fix incorrect `DeprecationWarning` shown when creating a `px` chart [[#5080](https://github.com/plotly/plotly.py/pull/5080), [#5086](https://github.com/plotly/plotly.py/pull/5086)]
15+
916

1017
## [6.0.0] - 2025-01-28
1118

Diff for: RELEASE.md

-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ Publishing to PyPI:
7070
### Update documentation site
7171

7272
1. Search for the previous version string in the docs and replace it with the new version string, including but not necessarily limited to the following files:
73-
- `doc/python/getting-started.md`
7473
- `doc/apidoc/conf.py`
7574
- `doc/requirements.txt`
7675
2. `doc-prod` should already have been merged on a regular basis into `main`, but

Diff for: codegen/datatypes.py

+21-6
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@ def build_datatype_py(node):
9898
)
9999
buffer.write(f"import copy as _copy\n")
100100

101-
if node.name_property in deprecated_mapbox_traces:
102-
buffer.write(f"from warnings import warn\n")
101+
if (
102+
node.name_property in deprecated_mapbox_traces
103+
or node.name_property == "template"
104+
):
105+
buffer.write(f"import warnings\n")
103106

104107
# Write class definition
105108
buffer.write(
@@ -350,10 +353,22 @@ def __init__(self"""
350353
buffer.write("\n\n")
351354
for subtype_node in subtype_nodes:
352355
name_prop = subtype_node.name_property
353-
buffer.write(
354-
f"""
356+
if datatype_class == "Template" and name_prop == "data":
357+
buffer.write(
358+
f"""
359+
# Template.data contains a 'scattermapbox' key, which causes a
360+
# go.Scattermapbox trace object to be created during validation.
361+
# In order to prevent false deprecation warnings from surfacing,
362+
# we suppress deprecation warnings for this line only.
363+
with warnings.catch_warnings():
364+
warnings.filterwarnings("ignore", category=DeprecationWarning)
365+
self._init_provided('{name_prop}', arg, {name_prop})"""
366+
)
367+
else:
368+
buffer.write(
369+
f"""
355370
self._init_provided('{name_prop}', arg, {name_prop})"""
356-
)
371+
)
357372

358373
### Literals
359374
if literal_nodes:
@@ -377,7 +392,7 @@ def __init__(self"""
377392
if node.name_property in deprecated_mapbox_traces:
378393
buffer.write(
379394
f"""
380-
warn(
395+
warnings.warn(
381396
"*{node.name_property}* is deprecated!"
382397
+ " Use *{node.name_property.replace("mapbox", "map")}* instead."
383398
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",

Diff for: doc/apidoc/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
# The short X.Y version
2727
version = ""
2828
# The full version, including alpha/beta/rc tags
29-
release = "6.0.0"
29+
release = "6.0.1"
3030

3131

3232
# -- General configuration ---------------------------------------------------

Diff for: doc/python/ml-pca.md

-12
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,6 @@ fig.update_traces(diagonal_visible=False)
136136
fig.show()
137137
```
138138

139-
## PCA analysis in Dash
140-
141-
[Dash](https://plotly.com/dash/) is the best way to build analytical apps in Python using Plotly figures. To run the app below, run `pip install dash`, click "Download" to get the code and run `python app.py`.
142-
143-
Get started with [the official Dash docs](https://dash.plotly.com/installation) and **learn how to effortlessly [style](https://plotly.com/dash/design-kit/) & [deploy](https://plotly.com/dash/app-manager/) apps like this with <a class="plotly-red" href="https://plotly.com/dash/">Dash Enterprise</a>.**
144-
145-
146-
```python hide_code=true
147-
from IPython.display import IFrame
148-
snippet_url = 'https://python-docs-dash-snippets.herokuapp.com/python-docs-dash-snippets/'
149-
IFrame(snippet_url + 'pca-visualization', width='100%', height=1200)
150-
```
151139

152140
<div style="font-size: 0.9em;"><div style="width: calc(100% - 30px); box-shadow: none; border: thin solid rgb(229, 229, 229);"><div style="padding: 5px;"><div><p><strong>Sign up for Dash Club</strong> → Free cheat sheets plus updates from Chris Parmer and Adam Schroeder delivered to your inbox every two months. Includes tips and tricks, community apps, and deep dives into the Dash architecture.
153141
<u><a href="https://go.plotly.com/dash-club?utm_source=Dash+Club+2022&utm_medium=graphing_libraries&utm_content=inline">Join now</a></u>.</p></div></div></div></div>

Diff for: doc/python/text-and-annotations.md

+60
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,66 @@ fig.add_annotation(
782782

783783
fig.show()
784784
```
785+
### Specifying Source Lines or Figure Notes on the Bottom of a Figure
786+
787+
This example shows how to add a note about the data source or interpretation at the bottom of the figure. This example aligns the note in the bottom right corner using the title element and container coordinates and then uses an annotation to add a figure title. A near zero container coordinate is an easy and robust way to put text -- such as a source line or figure note -- at the bottom of a figure. It is easier to specify the bottom of the figure in container coordinates than using paper coordinates, since uncertainty about the size of legends and x-axis labels make the paper coordinate of the bottom of the figure uncertain. Making the y container coordinate very slightly positive avoids cutting off the descending strokes of letters like y, p, and q. Only the title command supports container coordinates, so this example re-purposes the title element to insert the note and re-purposes an annotation element for the title. The top of the figure is typically less cluttered and more predictable than the bottom of the figure, so an annotation with its bottom at a paper y-coordinate slightly greater than 1 is a reasonable title location on many graphs.
788+
789+
```python
790+
import plotly.express as px
791+
df = px.data.iris()
792+
fig.update_layout(
793+
title=dict(text="Note: this is the Plotly title element.",
794+
# keeping this title string short avoids getting the text cut off in small windows
795+
# if you need longer text, consider 1) embedding your graphic on a web page and
796+
# putting the note in the HTML to use the browser's automated word wrap,
797+
# 2) using this approach and also specifying a graph width that shows the whole title,
798+
# or 3) using <BR> tags to wrap the text onto multiple lines
799+
yref="container",
800+
y=0.005,
801+
# The "paper" x-coordinates lets us align this with either the right or left
802+
# edge of the plot region.
803+
# The code to align this flush with the right edge of the plot area is
804+
# predictable and simple.
805+
# Putting the title in the lower left corner, aligned with the left edge of the axis labeling would
806+
# require graph specific coordinate adjustments.
807+
xref="paper",
808+
xanchor="right",
809+
x=1,
810+
font=dict(size=12)),
811+
plot_bgcolor="white",
812+
813+
# We move the legend out of the right margin so the right-aligned note is
814+
# flush with the right most element of the graph.
815+
# Here we put the legend in a corner of the graph region
816+
# because it has consistent coordinates at all screen resolutions.
817+
legend=dict(
818+
yanchor="top",
819+
y=1,
820+
xanchor="right",
821+
x=1,
822+
borderwidth=1)
823+
)
824+
825+
# Insert a title by repurposing an annotation
826+
fig.add_annotation(
827+
yref="paper",
828+
yanchor="bottom",
829+
y=1.025, # y = 1 is the top of the plot area; the top is typically uncluttered, so placing
830+
# the bottom of the title slightly above the graph region works on a wide variety of graphs
831+
text="This title is a Plotly annotation",
832+
833+
# Center the title horizontally over the plot area
834+
xref="paper",
835+
xanchor="center",
836+
x=0.5,
837+
838+
showarrow=False,
839+
font=dict(size=18)
840+
)
841+
842+
fig.show()
843+
```
844+
785845

786846
### Customize Displayed Text with a Text Template
787847

Diff for: doc/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
plotly==6.0.0
1+
plotly==6.0.1
22
jupytext==1.16.4
33
jupyter-client<7
44
jupyter

Diff for: js/package-lock.json

+19-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: js/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"dependencies": {
88
"lodash-es": "^4.17.21",
9-
"plotly.js": "3.0.0"
9+
"plotly.js": "3.0.1"
1010
},
1111
"devDependencies": {
1212
"@types/plotly.js": "^2.33.4",

Diff for: plotly/graph_objs/_choroplethmapbox.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
22
import copy as _copy
3-
from warnings import warn
3+
import warnings
44

55

66
class Choroplethmapbox(_BaseTraceType):
@@ -1768,7 +1768,7 @@ def __init__(
17681768
self._process_kwargs(**dict(arg, **kwargs))
17691769
self._skip_invalid = False
17701770

1771-
warn(
1771+
warnings.warn(
17721772
"*choroplethmapbox* is deprecated!"
17731773
+ " Use *choroplethmap* instead."
17741774
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",

Diff for: plotly/graph_objs/_densitymapbox.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
22
import copy as _copy
3-
from warnings import warn
3+
import warnings
44

55

66
class Densitymapbox(_BaseTraceType):
@@ -1740,7 +1740,7 @@ def __init__(
17401740
self._process_kwargs(**dict(arg, **kwargs))
17411741
self._skip_invalid = False
17421742

1743-
warn(
1743+
warnings.warn(
17441744
"*densitymapbox* is deprecated!"
17451745
+ " Use *densitymap* instead."
17461746
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",

Diff for: plotly/graph_objs/_figure.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
class Figure(BaseFigure):
5+
56
def __init__(
67
self, data=None, layout=None, frames=None, skip_invalid=False, **kwargs
78
):

Diff for: plotly/graph_objs/_figurewidget.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
class FigureWidget(BaseFigureWidget):
5+
56
def __init__(
67
self, data=None, layout=None, frames=None, skip_invalid=False, **kwargs
78
):

Diff for: plotly/graph_objs/_scattermapbox.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from plotly.basedatatypes import BaseTraceType as _BaseTraceType
22
import copy as _copy
3-
from warnings import warn
3+
import warnings
44

55

66
class Scattermapbox(_BaseTraceType):
@@ -1727,7 +1727,7 @@ def __init__(
17271727
self._process_kwargs(**dict(arg, **kwargs))
17281728
self._skip_invalid = False
17291729

1730-
warn(
1730+
warnings.warn(
17311731
"*scattermapbox* is deprecated!"
17321732
+ " Use *scattermap* instead."
17331733
+ " Learn more at: https://plotly.com/python/mapbox-to-maplibre/",

Diff for: plotly/graph_objs/layout/_template.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
22
import copy as _copy
3+
import warnings
34

45

56
class Template(_BaseLayoutHierarchyType):
@@ -120,7 +121,13 @@ def __init__(self, arg=None, data=None, layout=None, **kwargs):
120121
self._skip_invalid = kwargs.pop("skip_invalid", False)
121122
self._validate = kwargs.pop("_validate", True)
122123

123-
self._init_provided("data", arg, data)
124+
# Template.data contains a 'scattermapbox' key, which causes a
125+
# go.Scattermapbox trace object to be created during validation.
126+
# In order to prevent false deprecation warnings from surfacing,
127+
# we suppress deprecation warnings for this line only.
128+
with warnings.catch_warnings():
129+
warnings.filterwarnings("ignore", category=DeprecationWarning)
130+
self._init_provided("data", arg, data)
124131
self._init_provided("layout", arg, layout)
125132
self._process_kwargs(**dict(arg, **kwargs))
126133
self._skip_invalid = False

Diff for: plotly/offline/_plotlyjs_version.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# DO NOT EDIT
2-
# This file is generated by the updatebundle setup.py command
3-
__plotlyjs_version__ = "3.0.0"
2+
# This file is generated by the updatebundle commands.py command
3+
__plotlyjs_version__ = "3.0.1"

Diff for: plotly/package_data/plotly.min.js

+77-77
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: plotly/tools.py

-3
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ def warning_on_one_line(message, category, filename, lineno, file=None, line=Non
6161

6262
warnings.formatwarning = warning_on_one_line
6363

64-
ipython_core_display = optional_imports.get_module("IPython.core.display")
65-
sage_salvus = optional_imports.get_module("sage_salvus")
66-
6764

6865
### mpl-related tools ###
6966
def mpl_to_plotly(fig, resize=False, strip_style=False, verbose=False):

Diff for: plotly/validators/_data.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
class DataValidator(_plotly_utils.basevalidators.BaseDataValidator):
5+
56
def __init__(self, plotly_name="data", parent_name="", **kwargs):
67

78
super().__init__(

Diff for: pyproject.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ classifiers = [
3232
"Programming Language :: Python :: 3.10",
3333
"Programming Language :: Python :: 3.11",
3434
"Programming Language :: Python :: 3.12",
35+
"Programming Language :: Python :: 3.13",
3536
"Topic :: Scientific/Engineering :: Visualization",
3637
"License :: OSI Approved :: MIT License"
3738
]
3839
requires-python = ">=3.8"
3940
license = {file="LICENSE.txt"}
40-
version = "6.0.0"
41+
version = "6.0.1"
4142
dependencies = [
4243
"narwhals>=1.15.1",
4344
"packaging"

Diff for: test_requirements/requirements_310_core.txt

-3
This file was deleted.

Diff for: test_requirements/requirements_310_optional.txt

-24
This file was deleted.

0 commit comments

Comments
 (0)