Skip to content

Commit b8fe065

Browse files
authored
Merge branch 'main' into fix-histogram-contour-construction
2 parents 5435922 + b104c6a commit b8fe065

19 files changed

Lines changed: 521 additions & 425 deletions

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1212
- Fix `mpl_to_plotly` not setting `paper_bgcolor` and `plot_bgcolor` from the matplotlib figure and axes backgrounds, so converted figures match the source figure's background colors [[#5285](https://github.com/plotly/plotly.py/pull/5285)], with thanks to @robertoffmoura for the contribution!
1313
- Fix rendering issue causing a too-large div when calling `Figure.show()` in Google Colab [[#5718](https://github.com/plotly/plotly.py/pull/5718)]
1414

15+
### Updated
16+
- Update plotly.js from version 4.0.0 to version 4.1.0 [[#5722](https://github.com/plotly/plotly.py/pull/5722)]. See the [plotly.js release notes](https://github.com/plotly/plotly.js/releases/tag/v4.1.0) for details. Notable changes include:
17+
- Add an opt-in modebar button for downloading Plotly figures as JSON [[#7990](https://github.com/plotly/plotly.js/pull/7990), [#8022](https://github.com/plotly/plotly.js/pull/8022)]
18+
- Add `legend.groupdoubleclick` to set the group behavior for a legend double-click [[#7997](https://github.com/plotly/plotly.js/pull/7997)]
19+
- Increase default double-click delay threshold to 500ms (from 300) [[#8014](https://github.com/plotly/plotly.js/pull/8014)]
20+
- Fix issue with per-point marker color for hover labels in `scattergl`, `quiver` traces [[#8027](https://github.com/plotly/plotly.js/pull/8027)]
21+
1522
## [7.0.0] - 2026-08-25
1623

1724
### Fixed

CONTRIBUTING.md

Lines changed: 45 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -264,39 +264,58 @@ Two kinds of Jupyter support are included:
264264

265265
### Updating to a New Version of plotly.js
266266

267-
First, update the version of the `plotly.js` dependency in `js/package.json`.
268-
Once you have done that,
269-
run the `updateplotlyjs` command:
267+
We typically update the plotly.js version in plotly.py after every new plotly.js release.
270268

271-
```bash
272-
python commands.py updateplotlyjs
273-
```
269+
_Usually, the mostly-automated steps below are sufficient. However, in some cases, manual changes may be needed. For example, [plotly.js/#7580](https://github.com/plotly/plotly.js/pull/7580) required [#5464](https://github.com/plotly/plotly.py/pull/5464) and [#5465](https://github.com/plotly/plotly.py/pull/5465). This is most often the case when plotly.js is updated to accept additional value types for an attribute; plotly.py has its own validation layer which may need to be updated. When in doubt, test out a new plotly.js feature in plotly.py to verify that everything works._
274270

275-
This downloads new versions of `plot-schema.json` and `plotly.min.js` from the `plotly/plotly.js` GitHub repository
276-
and places them in `codegen/resources/` and `plotly/package_data/`, respectively.
271+
Steps to update plotly.js:
277272

278-
It then does the following:
279-
- Regenerates all of the `graph_objs` classes based on the new schema
280-
- Runs `npm install` in `js/` to refresh `js/package-lock.json` against the new `plotly.js`
281-
- Runs `npm run build` to rebuild the JupyterLab extension and FigureWidget bundles in `plotly/labextension` and `plotly/package_data/widgetbundle.js`.
273+
1. Create a new branch off of `main`.
282274

283-
Commit the updated files under:
284-
- `codegen/resources/`
285-
- `js/`
286-
- `plotly/graph_objs/`
287-
- `plotly/labextension/`
288-
- `plotly/offline/`
289-
- `plotly/package_data/`
275+
2. Manually update the version of the `plotly.js` dependency in `js/package.json`.
290276

291-
If you need to skip the `npm` steps entirely (e.g. `npm` isn't available),
292-
set the `SKIP_NPM=1` environment variable:
277+
3. Run the `updateplotlyjs` command:
293278

294-
```bash
295-
SKIP_NPM=1 python commands.py updateplotlyjs
296-
```
279+
```bash
280+
python commands.py updateplotlyjs
281+
```
297282

298-
If you do skip it, you'll need to find a way to manually run `npm install && npm run build` in `js/` before committing,
299-
so that the lockfile and build artifacts stay in sync with `js/package.json`.
283+
This command does the following:
284+
285+
- Downloads new versions of `plot-schema.json` and `plotly.min.js` from the [plotly.js GitHub repository](https://github.com/plotly/plotly.js)
286+
and places them in `codegen/resources/` and `plotly/package_data/`, respectively.
287+
- Updates `plotly/offline/_plotlyjs_version.py` with the new version
288+
- Regenerates all of the classes under `graph_objs/` (`go.Figure`, `go.Layout`, etc.), and `plotly/validators/_validators.json`, based on the new schema
289+
- Runs `npm install` in `js/` to update `js/package-lock.json`
290+
- Runs `npm run build` in `js/` to rebuild the JupyterLab extension and FigureWidget bundles, which updates the artifacts in `plotly/labextension` and `plotly/package_data/widgetbundle.js`.
291+
292+
> Note: To skip the `npm` steps entirely (e.g. if `npm` isn't available), you can set the `SKIP_NPM=1` environment variable:
293+
>
294+
> ```bash
295+
> SKIP_NPM=1 python commands.py updateplotlyjs
296+
> ```
297+
>
298+
> However, before proceeding further, you'll still need to somehow run `npm install && npm run build` in `js/` before committing, so that the lockfile and build artifacts stay in sync with `js/package.json`.
299+
300+
4. Commit the updated files under:
301+
- `codegen/resources/`
302+
- `js/`
303+
- `plotly/graph_objs/`
304+
- `plotly/labextension/`
305+
- `plotly/offline/`
306+
- `plotly/package_data/`
307+
308+
5. To double-check that the update worked properly, you can use this one-liner:
309+
310+
```bash
311+
pip install -e . && python -c "import plotly.graph_objects as go; fig = go.Figure([go.Scatter(y=[2,1,3])]); fig.show()"
312+
```
313+
314+
The plot will open in a browser window; hover over the Plotly logo in the modebar in the upper-right corner to verify that the plotly.js version is correct.
315+
316+
6. Open a PR into `main`.
317+
318+
7. Add a changelog entry to `CHANGELOG.md` with a link to the PR. We typically mention the version update, link to the plotly.js GitHub release page, and list out the most important changes. Follow the format of previous plotly.js version bump changelog updates.
300319

301320
### Using a Development Branch of Plotly.js
302321

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016-2024 Plotly Technologies Inc.
3+
Copyright (c) 2016-2026 Plotly Technologies Inc.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ on your command line.
130130

131131
## Copyright and Licenses
132132

133-
Code and documentation copyright 2019 Plotly, Inc.
133+
Code and documentation copyright 2026 Plotly, Inc.
134134

135135
Code released under the [MIT license](https://github.com/plotly/plotly.py/blob/main/LICENSE.txt).
136136

codegen/resources/plot-schema.json

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@
142142
},
143143
"doubleClickDelay": {
144144
"description": "Sets the delay for registering a double-click in ms. This is the time interval (in ms) between first mousedown and 2nd mouseup to constitute a double-click. This setting propagates to all on-subplot double clicks (except for geo and map) and on-legend double clicks.",
145-
"dflt": 300,
145+
"dflt": 500,
146146
"min": 0,
147147
"valType": "number"
148148
},
@@ -244,7 +244,7 @@
244244
"valType": "any"
245245
},
246246
"modeBarButtonsToAdd": {
247-
"description": "Add mode bar button using config objects See ./components/modebar/buttons.js for list of arguments. To enable predefined modebar buttons e.g. shape drawing, hover and spikelines, simply provide their string name(s). This could include: *v1hovermode*, *hoverclosest*, *hovercompare*, *togglehover*, *togglespikelines*, *drawline*, *drawopenpath*, *drawclosedpath*, *drawcircle*, *drawrect* and *eraseshape*. Please note that these predefined buttons will only be shown if they are compatible with all trace types used in a graph.",
247+
"description": "Add mode bar button using config objects See ./components/modebar/buttons.js for list of arguments. To enable predefined modebar buttons e.g. shape drawing, hover and spikelines, simply provide their string name(s). This could include: *v1hovermode*, *hoverclosest*, *hovercompare*, *togglehover*, *togglespikelines*, *drawline*, *drawopenpath*, *drawclosedpath*, *drawcircle*, *drawrect*, *eraseshape* and *downloadJson*. Please note that these predefined buttons will only be shown if they are compatible with all trace types used in a graph.",
248248
"dflt": [],
249249
"valType": "any"
250250
},
@@ -3312,6 +3312,15 @@
33123312
"togglegroup"
33133313
]
33143314
},
3315+
"groupdoubleclick": {
3316+
"description": "Determines the behavior on legend group item double-click. *toggleitem* toggles the visibility of the individual item clicked on the graph. *togglegroup* toggles the visibility of all items in the same legendgroup as the item clicked on the graph. Defaults to the value of `groupclick`.",
3317+
"editType": "legend",
3318+
"valType": "enumerated",
3319+
"values": [
3320+
"toggleitem",
3321+
"togglegroup"
3322+
]
3323+
},
33153324
"grouptitlefont": {
33163325
"color": {
33173326
"editType": "legend",
@@ -4167,7 +4176,7 @@
41674176
},
41684177
"add": {
41694178
"arrayOk": true,
4170-
"description": "Determines which predefined modebar buttons to add. Please note that these buttons will only be shown if they are compatible with all trace types used in a graph. Similar to `config.modeBarButtonsToAdd` option. This may include *v1hovermode*, *hoverclosest*, *hovercompare*, *togglehover*, *togglespikelines*, *drawline*, *drawopenpath*, *drawclosedpath*, *drawcircle*, *drawrect*, *eraseshape*.",
4179+
"description": "Determines which predefined modebar buttons to add. Please note that these buttons will only be shown if they are compatible with all trace types used in a graph. Similar to `config.modeBarButtonsToAdd` option. This may include *v1hovermode*, *hoverclosest*, *hovercompare*, *togglehover*, *togglespikelines*, *drawline*, *drawopenpath*, *drawclosedpath*, *drawcircle*, *drawrect*, *eraseshape*, *downloadJson*.",
41714180
"dflt": "",
41724181
"editType": "modebar",
41734182
"valType": "string"
@@ -13953,7 +13962,7 @@
1395313962
"valType": "boolean"
1395413963
},
1395513964
"showspikes": {
13956-
"description": "Determines whether or not spikes (aka droplines) are drawn for this axis. Note: This only takes affect when hovermode = closest",
13965+
"description": "Determines whether or not spikes (aka droplines) are drawn for this axis. Note that spikes will never be drawn when `hovermode` is *false*.",
1395713966
"dflt": false,
1395813967
"editType": "modebar",
1395913968
"valType": "boolean"
@@ -15202,7 +15211,7 @@
1520215211
"valType": "boolean"
1520315212
},
1520415213
"showspikes": {
15205-
"description": "Determines whether or not spikes (aka droplines) are drawn for this axis. Note: This only takes affect when hovermode = closest",
15214+
"description": "Determines whether or not spikes (aka droplines) are drawn for this axis. Note that spikes will never be drawn when `hovermode` is *false*.",
1520615215
"dflt": false,
1520715216
"editType": "modebar",
1520815217
"valType": "boolean"

js/lib/mimeExtension.js

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

js/package-lock.json

Lines changed: 16 additions & 8 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
@@ -19,7 +19,7 @@
1919
},
2020
"dependencies": {
2121
"lodash-es": "^4.17.21",
22-
"plotly.js": "4.0.0",
22+
"plotly.js": "4.1.0",
2323
"@lumino/widgets": "~2.4.0"
2424
},
2525
"devDependencies": {

plotly/graph_objs/layout/_legend.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Legend(_BaseLayoutHierarchyType):
1616
"entrywidthmode",
1717
"font",
1818
"groupclick",
19+
"groupdoubleclick",
1920
"grouptitlefont",
2021
"indentation",
2122
"itemclick",
@@ -198,6 +199,29 @@ def groupclick(self):
198199
def groupclick(self, val):
199200
self["groupclick"] = val
200201

202+
@property
203+
def groupdoubleclick(self):
204+
"""
205+
Determines the behavior on legend group item double-click.
206+
"toggleitem" toggles the visibility of the individual item
207+
clicked on the graph. "togglegroup" toggles the visibility of
208+
all items in the same legendgroup as the item clicked on the
209+
graph. Defaults to the value of `groupclick`.
210+
211+
The 'groupdoubleclick' property is an enumeration that may be specified as:
212+
- One of the following enumeration values:
213+
['toggleitem', 'togglegroup']
214+
215+
Returns
216+
-------
217+
Any
218+
"""
219+
return self["groupdoubleclick"]
220+
221+
@groupdoubleclick.setter
222+
def groupdoubleclick(self, val):
223+
self["groupdoubleclick"] = val
224+
201225
@property
202226
def grouptitlefont(self):
203227
"""
@@ -702,6 +726,13 @@ def _prop_descriptions(self):
702726
item clicked on the graph. "togglegroup" toggles the
703727
visibility of all items in the same legendgroup as the
704728
item clicked on the graph.
729+
groupdoubleclick
730+
Determines the behavior on legend group item double-
731+
click. "toggleitem" toggles the visibility of the
732+
individual item clicked on the graph. "togglegroup"
733+
toggles the visibility of all items in the same
734+
legendgroup as the item clicked on the graph. Defaults
735+
to the value of `groupclick`.
705736
grouptitlefont
706737
Sets the font for group titles in legend. Defaults to
707738
`legend.font` with its size increased about 10%.
@@ -835,6 +866,7 @@ def __init__(
835866
entrywidthmode=None,
836867
font=None,
837868
groupclick=None,
869+
groupdoubleclick=None,
838870
grouptitlefont=None,
839871
indentation=None,
840872
itemclick=None,
@@ -889,6 +921,13 @@ def __init__(
889921
item clicked on the graph. "togglegroup" toggles the
890922
visibility of all items in the same legendgroup as the
891923
item clicked on the graph.
924+
groupdoubleclick
925+
Determines the behavior on legend group item double-
926+
click. "toggleitem" toggles the visibility of the
927+
individual item clicked on the graph. "togglegroup"
928+
toggles the visibility of all items in the same
929+
legendgroup as the item clicked on the graph. Defaults
930+
to the value of `groupclick`.
892931
grouptitlefont
893932
Sets the font for group titles in legend. Defaults to
894933
`legend.font` with its size increased about 10%.
@@ -1042,6 +1081,7 @@ def __init__(
10421081
self._set_property("entrywidthmode", arg, entrywidthmode)
10431082
self._set_property("font", arg, font)
10441083
self._set_property("groupclick", arg, groupclick)
1084+
self._set_property("groupdoubleclick", arg, groupdoubleclick)
10451085
self._set_property("grouptitlefont", arg, grouptitlefont)
10461086
self._set_property("indentation", arg, indentation)
10471087
self._set_property("itemclick", arg, itemclick)

plotly/graph_objs/layout/_modebar.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def add(self):
5656
`config.modeBarButtonsToAdd` option. This may include
5757
"v1hovermode", "hoverclosest", "hovercompare", "togglehover",
5858
"togglespikelines", "drawline", "drawopenpath",
59-
"drawclosedpath", "drawcircle", "drawrect", "eraseshape".
59+
"drawclosedpath", "drawcircle", "drawrect", "eraseshape",
60+
"downloadJson".
6061
6162
The 'add' property is a string and must be specified as:
6263
- A string
@@ -216,7 +217,7 @@ def _prop_descriptions(self):
216217
This may include "v1hovermode", "hoverclosest",
217218
"hovercompare", "togglehover", "togglespikelines",
218219
"drawline", "drawopenpath", "drawclosedpath",
219-
"drawcircle", "drawrect", "eraseshape".
220+
"drawcircle", "drawrect", "eraseshape", "downloadJson".
220221
bgcolor
221222
Sets the background color of the modebar.
222223
color
@@ -281,7 +282,7 @@ def __init__(
281282
This may include "v1hovermode", "hoverclosest",
282283
"hovercompare", "togglehover", "togglespikelines",
283284
"drawline", "drawopenpath", "drawclosedpath",
284-
"drawcircle", "drawrect", "eraseshape".
285+
"drawcircle", "drawrect", "eraseshape", "downloadJson".
285286
bgcolor
286287
Sets the background color of the modebar.
287288
color

0 commit comments

Comments
 (0)