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

.circleci/config.yml

Lines changed: 128 additions & 209 deletions
Large diffs are not rendered by default.

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
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

RELEASE.md

Lines changed: 0 additions & 1 deletion
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

codegen/datatypes.py

Lines changed: 21 additions & 6 deletions
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/",

doc/apidoc/conf.py

Lines changed: 1 addition & 1 deletion
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 ---------------------------------------------------

doc/python/ml-pca.md

Lines changed: 0 additions & 12 deletions
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>

doc/python/text-and-annotations.md

Lines changed: 60 additions & 0 deletions
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

doc/requirements.txt

Lines changed: 1 addition & 1 deletion
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

js/package-lock.json

Lines changed: 19 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/package.json

Lines changed: 1 addition & 1 deletion
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",

0 commit comments

Comments
 (0)