Skip to content

Commit db310b2

Browse files
committed
Merge commit '2e2d1f0c8' into sgthumb
* commit '2e2d1f0c8': (38 commits) Switch to alternate fence syntax docs: keep troubleshooting paragraph on one line docs: move Jupyter troubleshooting section docs: add Jupyter blank-render troubleshooting skip changelog check if draft, and display messages for all outcomes Apply suggestions from code review update changelog instructions in CONTRIBUTING.md Revert "add dummy changelog entry" add dummy changelog entry add CI workflow to make sure changelog gets updated with every PR update changelog update years in license and README update instructions for updateplotlyjs command update plotly.js to v4.1.0 update changelog do not use full_html for google colab renderer Add changelog entry Add yticks test Export tick text for FixedFormatter tick labels Update uneven tick spacing warning to reflect explicit tickvals export ...
2 parents 2d2adff + 2e2d1f0 commit db310b2

32 files changed

Lines changed: 949 additions & 450 deletions
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Check changelog
2+
3+
on:
4+
pull_request:
5+
types: [opened, reopened, synchronize, labeled, unlabeled, ready_for_review]
6+
7+
concurrency:
8+
group: check-changelog-${{ github.event.pull_request.number }}
9+
cancel-in-progress: true
10+
11+
permissions:
12+
contents: read
13+
pull-requests: read
14+
15+
jobs:
16+
check-changelog:
17+
name: Check if CHANGELOG.md was updated
18+
if: ${{ !github.event.pull_request.draft }}
19+
runs-on: ubuntu-latest
20+
env:
21+
GH_TOKEN: ${{ github.token }}
22+
HAS_SKIP_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'no-changelog') }}
23+
steps:
24+
- run: |
25+
if [ "$HAS_SKIP_LABEL" = true ]; then
26+
echo "::notice::This PR has the 'no-changelog' label, so a change to CHANGELOG.md is not required."
27+
elif gh api "repos/${{ github.repository }}/pulls/${{ github.event.number }}/files" --paginate --jq '.[].filename' | grep -qx CHANGELOG.md; then
28+
echo "::notice::CHANGELOG.md was updated."
29+
else
30+
echo "::error::CHANGELOG.md was not updated. Either add a changelog entry, or add the 'no-changelog' label to this PR if a changelog entry is not needed."
31+
exit 1
32+
fi

‎CHANGELOG.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,21 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## Unreleased
66

7+
### Added
8+
- Support `marginal_x`/`marginal_y="heatmap"` in `density_heatmap`, drawing a single-row/column heatmap strip in the margin colored by the same `z`/`histfunc` aggregate as the main plot and sharing its color scale [[#5706](https://github.com/plotly/plotly.py/issues/5706)], with thanks to @lucasjamar for the contribution!
9+
- Add support for custom tick values in `mpl_to_plotly` when the matplotlib tick positions don't follow an arithmetic progression, including custom tick labels and tick values on date axes [[#5262](https://github.com/plotly/plotly.py/pull/5262)], with thanks to @robertoffmoura for the contribution!
10+
711
### Fixed
12+
- 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!
13+
- Fix rendering issue causing a too-large div when calling `Figure.show()` in Google Colab [[#5718](https://github.com/plotly/plotly.py/pull/5718)]
814
- Fix the sphinx-gallery scraper so that it generates thumbnails for figures shown with `fig.show()` or displayed as the last expression of a code block, warns once (instead of failing the build) when static image export is unavailable, and no longer scrapes files belonging to other examples during parallel builds [[#4722](https://github.com/plotly/plotly.py/issues/4722), [#4959](https://github.com/plotly/plotly.py/issues/4959)], with thanks to @larsoner for the contribution!
915

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

1123
## [7.0.0] - 2026-08-25
1224

‎CONTRIBUTING.md‎

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ When creating your pull request, please follow the guidelines below.
181181
- If your PR modifies code of `plotly.graph_objects`, the modifications should be made to the code generator, *not* the generated files.
182182
- You have added tests or modified existing tests, as needed.
183183
- For a new feature, you have added documentation examples (please see the doc checklist as well).
184-
- You have added a CHANGELOG entry if changing anything substantial.
184+
- You have added a changelog entry to `CHANGELOG.md` if changing anything substantial.
185+
- The CI job "Check changelog" will fail if the PR does not update `CHANGELOG.md`. To bypass this check for PRs which don't require a changelog entry (e.g. docs updates), add the `no-changelog` label to the PR.
185186
- For a new feature or a change in behavior, you have updated the relevant docstrings in the code.
186187

187188
### Documentation pull request
@@ -264,39 +265,58 @@ Two kinds of Jupyter support are included:
264265

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

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:
268+
We typically update the plotly.js version in plotly.py after every new plotly.js release.
270269

271-
```bash
272-
python commands.py updateplotlyjs
273-
```
270+
_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._
274271

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.
272+
Steps to update plotly.js:
277273

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`.
274+
1. Create a new branch off of `main`.
282275

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/`
276+
2. Manually update the version of the `plotly.js` dependency in `js/package.json`.
290277

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

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

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`.
284+
This command does the following:
285+
286+
- Downloads new versions of `plot-schema.json` and `plotly.min.js` from the [plotly.js GitHub repository](https://github.com/plotly/plotly.js)
287+
and places them in `codegen/resources/` and `plotly/package_data/`, respectively.
288+
- Updates `plotly/offline/_plotlyjs_version.py` with the new version
289+
- Regenerates all of the classes under `graph_objs/` (`go.Figure`, `go.Layout`, etc.), and `plotly/validators/_validators.json`, based on the new schema
290+
- Runs `npm install` in `js/` to update `js/package-lock.json`
291+
- 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`.
292+
293+
> Note: To skip the `npm` steps entirely (e.g. if `npm` isn't available), you can set the `SKIP_NPM=1` environment variable:
294+
>
295+
> ```bash
296+
> SKIP_NPM=1 python commands.py updateplotlyjs
297+
> ```
298+
>
299+
> 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`.
300+
301+
4. Commit the updated files under:
302+
- `codegen/resources/`
303+
- `js/`
304+
- `plotly/graph_objs/`
305+
- `plotly/labextension/`
306+
- `plotly/offline/`
307+
- `plotly/package_data/`
308+
309+
5. To double-check that the update worked properly, you can use this one-liner:
310+
311+
```bash
312+
pip install -e . && python -c "import plotly.graph_objects as go; fig = go.Figure([go.Scatter(y=[2,1,3])]); fig.show()"
313+
```
314+
315+
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.
316+
317+
6. Open a PR into `main`.
318+
319+
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.
300320

301321
### Using a Development Branch of Plotly.js
302322

‎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"

‎doc/python/marginal-plots.md‎

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Marginal distribution plots are small subplots above or to the right of a main p
3939

4040
### Scatter Plot Marginals
4141

42-
The `marginal_x` and `marginal_y` arguments accept one of `"histogram"`, `"rug"`, `"box"`, or `"violin"` (see also how to create [histograms](/python/histograms/), [box plots](/python/box-plots/) and [violin plots](/python/violin-plots/) as the main figure).
42+
The `marginal_x` and `marginal_y` arguments accept one of `"histogram"`, `"rug"`, `"box"`, or `"violin"` (see also how to create [histograms](/python/histograms/), [box plots](/python/box-plots/) and [violin plots](/python/violin-plots/) as the main figure), plus `"heatmap"` for `density_heatmap` (see below).
4343

4444
Marginal plots are linked to the main plot: try zooming or panning on the main plot.
4545

@@ -59,6 +59,27 @@ fig = px.density_heatmap(df, x="sepal_length", y="sepal_width", marginal_x="box"
5959
fig.show()
6060
```
6161

62+
### Marginal Heatmaps on Density Heatmaps
63+
64+
`marginal_x` and `marginal_y` also accept `"heatmap"` for [`density_heatmap`](/python/2D-Histogram/). This draws a single-row or single-column heatmap strip, colored by the same aggregate (`histfunc` of `z`, or count by default) as the main plot, and sharing its color scale. This is not supported for `density_contour`, since a contour plot's colorbar is discrete and not compatible with the continuous colorbar used by the marginal heatmap.
65+
66+
```python
67+
import plotly.express as px
68+
df = px.data.tips()
69+
fig = px.density_heatmap(df, x="total_bill", y="tip", marginal_x="heatmap", marginal_y="heatmap")
70+
fig.show()
71+
```
72+
73+
Set `text_auto=True` to display the aggregate value as text on both the main plot and the marginal heatmap strips, or pass a [d3-format](https://github.com/d3/d3-format) string such as `".2f"` to control the number of decimal places:
74+
75+
```python
76+
import plotly.express as px
77+
df = px.data.tips()
78+
fig = px.density_heatmap(df, x="total_bill", y="tip", z="size", histfunc="avg",
79+
marginal_x="heatmap", marginal_y="heatmap", text_auto=".1f")
80+
fig.show()
81+
```
82+
6283
### Marginal Plots and Color
6384

6485
Marginal plots respect the `color` argument as well, and are linked to the respective legend elements. Try clicking on the legend items.

‎doc/python/troubleshooting.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,15 @@ The situation is similar for environments like Nteract and Streamlit: in these e
7878
### Orca Problems
7979

8080
> The Orca image-generation utility is no longer supported in Plotly.py as of version 7.0.0. See the [Static Image Export page](/python/static-image-export/) for details on using Kaleido for static image generation.
81+
82+
### Jupyter and JupyterLab Problems
83+
84+
If a figure appears blank in JupyterLab, first check that the Jupyter server environment and the environment used by the notebook kernel can both access the Plotly packages they need. This is especially important when JupyterLab and `plotly` are installed in separate virtual environments.
85+
86+
As a workaround, try the `notebook` renderer explicitly:
87+
88+
~~~python
89+
fig.show(renderer="notebook")
90+
~~~
91+
92+
This can help when the default renderer does not display the figure correctly.

‎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.

0 commit comments

Comments
 (0)