Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- 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!
- Fix rendering issue causing a too-large div when calling `Figure.show()` in Google Colab [[#5718](https://github.com/plotly/plotly.py/pull/5718)]

### Updated
- 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:
- 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)]
- Add `legend.groupdoubleclick` to set the group behavior for a legend double-click [[#7997](https://github.com/plotly/plotly.js/pull/7997)]
- Increase default double-click delay threshold to 500ms (from 300) [[#8014](https://github.com/plotly/plotly.js/pull/8014)]
- Fix issue with per-point marker color for hover labels in `scattergl`, `quiver` traces [[#8027](https://github.com/plotly/plotly.js/pull/8027)]

## [7.0.0] - 2026-08-25

### Fixed
Expand Down
71 changes: 45 additions & 26 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,39 +264,58 @@ Two kinds of Jupyter support are included:

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

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

```bash
python commands.py updateplotlyjs
```
_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._

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

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

Commit the updated files under:
- `codegen/resources/`
- `js/`
- `plotly/graph_objs/`
- `plotly/labextension/`
- `plotly/offline/`
- `plotly/package_data/`
2. Manually update the version of the `plotly.js` dependency in `js/package.json`.

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

```bash
SKIP_NPM=1 python commands.py updateplotlyjs
```
```bash
python commands.py updateplotlyjs
```

If you do skip it, you'll need to find a way to manually run `npm install && npm run build` in `js/` before committing,
so that the lockfile and build artifacts stay in sync with `js/package.json`.
This command does the following:

- Downloads new versions of `plot-schema.json` and `plotly.min.js` from the [plotly.js GitHub repository](https://github.com/plotly/plotly.js)
and places them in `codegen/resources/` and `plotly/package_data/`, respectively.
- Updates `plotly/offline/_plotlyjs_version.py` with the new version
- Regenerates all of the classes under `graph_objs/` (`go.Figure`, `go.Layout`, etc.), and `plotly/validators/_validators.json`, based on the new schema
- Runs `npm install` in `js/` to update `js/package-lock.json`
- 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`.

> Note: To skip the `npm` steps entirely (e.g. if `npm` isn't available), you can set the `SKIP_NPM=1` environment variable:
>
> ```bash
> SKIP_NPM=1 python commands.py updateplotlyjs
> ```
>
> 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`.

4. Commit the updated files under:
- `codegen/resources/`
- `js/`
- `plotly/graph_objs/`
- `plotly/labextension/`
- `plotly/offline/`
- `plotly/package_data/`

5. To double-check that the update worked properly, you can use this one-liner:

```bash
pip install -e . && python -c "import plotly.graph_objects as go; fig = go.Figure([go.Scatter(y=[2,1,3])]); fig.show()"
```

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.

6. Open a PR into `main`.

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.

### Using a Development Branch of Plotly.js

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

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

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ on your command line.

## Copyright and Licenses

Code and documentation copyright 2019 Plotly, Inc.
Code and documentation copyright 2026 Plotly, Inc.

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

Expand Down
19 changes: 14 additions & 5 deletions codegen/resources/plot-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@
},
"doubleClickDelay": {
"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.",
"dflt": 300,
"dflt": 500,
"min": 0,
"valType": "number"
},
Expand Down Expand Up @@ -244,7 +244,7 @@
"valType": "any"
},
"modeBarButtonsToAdd": {
"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.",
"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.",
"dflt": [],
"valType": "any"
},
Expand Down Expand Up @@ -3312,6 +3312,15 @@
"togglegroup"
]
},
"groupdoubleclick": {
"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`.",
"editType": "legend",
"valType": "enumerated",
"values": [
"toggleitem",
"togglegroup"
]
},
"grouptitlefont": {
"color": {
"editType": "legend",
Expand Down Expand Up @@ -4167,7 +4176,7 @@
},
"add": {
"arrayOk": true,
"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*.",
"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*.",
"dflt": "",
"editType": "modebar",
"valType": "string"
Expand Down Expand Up @@ -13953,7 +13962,7 @@
"valType": "boolean"
},
"showspikes": {
"description": "Determines whether or not spikes (aka droplines) are drawn for this axis. Note: This only takes affect when hovermode = closest",
"description": "Determines whether or not spikes (aka droplines) are drawn for this axis. Note that spikes will never be drawn when `hovermode` is *false*.",
"dflt": false,
"editType": "modebar",
"valType": "boolean"
Expand Down Expand Up @@ -15202,7 +15211,7 @@
"valType": "boolean"
},
"showspikes": {
"description": "Determines whether or not spikes (aka droplines) are drawn for this axis. Note: This only takes affect when hovermode = closest",
"description": "Determines whether or not spikes (aka droplines) are drawn for this axis. Note that spikes will never be drawn when `hovermode` is *false*.",
"dflt": false,
"editType": "modebar",
"valType": "boolean"
Expand Down
258 changes: 129 additions & 129 deletions js/lib/mimeExtension.js

Large diffs are not rendered by default.

24 changes: 16 additions & 8 deletions js/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"lodash-es": "^4.17.21",
"plotly.js": "4.0.0",
"plotly.js": "4.1.0",
"@lumino/widgets": "~2.4.0"
},
"devDependencies": {
Expand Down
40 changes: 40 additions & 0 deletions plotly/graph_objs/layout/_legend.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class Legend(_BaseLayoutHierarchyType):
"entrywidthmode",
"font",
"groupclick",
"groupdoubleclick",
"grouptitlefont",
"indentation",
"itemclick",
Expand Down Expand Up @@ -198,6 +199,29 @@ def groupclick(self):
def groupclick(self, val):
self["groupclick"] = val

@property
def groupdoubleclick(self):
"""
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`.

The 'groupdoubleclick' property is an enumeration that may be specified as:
- One of the following enumeration values:
['toggleitem', 'togglegroup']

Returns
-------
Any
"""
return self["groupdoubleclick"]

@groupdoubleclick.setter
def groupdoubleclick(self, val):
self["groupdoubleclick"] = val

@property
def grouptitlefont(self):
"""
Expand Down Expand Up @@ -702,6 +726,13 @@ def _prop_descriptions(self):
item clicked on the graph. "togglegroup" toggles the
visibility of all items in the same legendgroup as the
item clicked on the graph.
groupdoubleclick
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`.
grouptitlefont
Sets the font for group titles in legend. Defaults to
`legend.font` with its size increased about 10%.
Expand Down Expand Up @@ -835,6 +866,7 @@ def __init__(
entrywidthmode=None,
font=None,
groupclick=None,
groupdoubleclick=None,
grouptitlefont=None,
indentation=None,
itemclick=None,
Expand Down Expand Up @@ -889,6 +921,13 @@ def __init__(
item clicked on the graph. "togglegroup" toggles the
visibility of all items in the same legendgroup as the
item clicked on the graph.
groupdoubleclick
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`.
grouptitlefont
Sets the font for group titles in legend. Defaults to
`legend.font` with its size increased about 10%.
Expand Down Expand Up @@ -1042,6 +1081,7 @@ def __init__(
self._set_property("entrywidthmode", arg, entrywidthmode)
self._set_property("font", arg, font)
self._set_property("groupclick", arg, groupclick)
self._set_property("groupdoubleclick", arg, groupdoubleclick)
self._set_property("grouptitlefont", arg, grouptitlefont)
self._set_property("indentation", arg, indentation)
self._set_property("itemclick", arg, itemclick)
Expand Down
7 changes: 4 additions & 3 deletions plotly/graph_objs/layout/_modebar.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ def add(self):
`config.modeBarButtonsToAdd` option. This may include
"v1hovermode", "hoverclosest", "hovercompare", "togglehover",
"togglespikelines", "drawline", "drawopenpath",
"drawclosedpath", "drawcircle", "drawrect", "eraseshape".
"drawclosedpath", "drawcircle", "drawrect", "eraseshape",
"downloadJson".

The 'add' property is a string and must be specified as:
- A string
Expand Down Expand Up @@ -216,7 +217,7 @@ def _prop_descriptions(self):
This may include "v1hovermode", "hoverclosest",
"hovercompare", "togglehover", "togglespikelines",
"drawline", "drawopenpath", "drawclosedpath",
"drawcircle", "drawrect", "eraseshape".
"drawcircle", "drawrect", "eraseshape", "downloadJson".
bgcolor
Sets the background color of the modebar.
color
Expand Down Expand Up @@ -281,7 +282,7 @@ def __init__(
This may include "v1hovermode", "hoverclosest",
"hovercompare", "togglehover", "togglespikelines",
"drawline", "drawopenpath", "drawclosedpath",
"drawcircle", "drawrect", "eraseshape".
"drawcircle", "drawrect", "eraseshape", "downloadJson".
bgcolor
Sets the background color of the modebar.
color
Expand Down
12 changes: 6 additions & 6 deletions plotly/graph_objs/layout/_xaxis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1313,8 +1313,8 @@ def showline(self, val):
def showspikes(self):
"""
Determines whether or not spikes (aka droplines) are drawn for
this axis. Note: This only takes affect when hovermode =
closest
this axis. Note that spikes will never be drawn when
`hovermode` is False.

The 'showspikes' property is a boolean and must be specified as:
- A boolean value: True or False
Expand Down Expand Up @@ -2554,8 +2554,8 @@ def _prop_descriptions(self):
drawn.
showspikes
Determines whether or not spikes (aka droplines) are
drawn for this axis. Note: This only takes affect when
hovermode = closest
drawn for this axis. Note that spikes will never be
drawn when `hovermode` is False.
showticklabels
Determines whether or not the tick labels are drawn.
showtickprefix
Expand Down Expand Up @@ -3186,8 +3186,8 @@ def __init__(
drawn.
showspikes
Determines whether or not spikes (aka droplines) are
drawn for this axis. Note: This only takes affect when
hovermode = closest
drawn for this axis. Note that spikes will never be
drawn when `hovermode` is False.
showticklabels
Determines whether or not the tick labels are drawn.
showtickprefix
Expand Down
Loading