Skip to content
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Fix Plotly Express mutating lists passed to the `x` or `y` arguments in wide mode [[#5727](https://github.com/plotly/plotly.py/pull/5727)], with thanks to @cpruijsen for the contribution!
- Fix `px.sunburst`, `px.treemap` and `px.icicle` listing sectors in a different order on every run when `path` is used with a Polars DataFrame; sectors now follow their order of first appearance for all dataframe backends [[#5766](https://github.com/plotly/plotly.py/pull/5766)], with thanks to @Irahan2 for the contribution!
- Fix `mpl_to_plotly` conversion of matplotlib contour lines and line collections: close contour rings ending with `Z` codes, support dash styles, convert date x-axes, separate disjoint subpaths with `None` separators, hide line collection traces from the legend by default, and group consecutive same-style lines into single traces [[#5770](https://github.com/plotly/plotly.py/pull/5770)], with thanks to @robertoffmoura for the contribution!
- Fix serialization of box/lasso select data for multiple subplots

## [7.1.0] - 2026-09-15

Expand Down
32 changes: 19 additions & 13 deletions js/src/widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ type Py2JsUpdateMsg = Py2JsMsg & {

type Selector = {
type: "box" | "lasso";
selector_state:
| { xrange: number[]; yrange: number[] }
| { xs: number[]; ys: number[] };
selector_state: Record<string, any>;
};

// Model
Expand Down Expand Up @@ -1149,22 +1147,30 @@ export class FigureView {
var selectorObject: Selector;

if (data.hasOwnProperty("range")) {
// Box selection
// Box selection - preserve all subplot-specific axis keys (x, x2, x3, ... and y, y2, y3, ...)
var rangeData = data["range"];
// Verify we have at least an x and y range (in any subplot)
var hasXRange = Object.keys(rangeData || {}).some((key: string) => /^x\d*$/.test(key));
var hasYRange = Object.keys(rangeData || {}).some((key: string) => /^y\d*$/.test(key));
if (!hasXRange || !hasYRange) {
return null;
}
selectorObject = {
type: "box",
selector_state: {
xrange: data["range"]["x"],
yrange: data["range"]["y"],
},
selector_state: rangeData,
};
} else if (data.hasOwnProperty("lassoPoints")) {
// Lasso selection
// Lasso selection - preserve all subplot-specific axis keys
var lassoData = data["lassoPoints"];
// Verify we have at least an x and y coordinate array (in any subplot)
var hasXCoords = Object.keys(lassoData || {}).some((key: string) => /^x\d*$/.test(key));
var hasYCoords = Object.keys(lassoData || {}).some((key: string) => /^y\d*$/.test(key));
if (!hasXCoords || !hasYCoords) {
return null;
}
selectorObject = {
type: "lasso",
selector_state: {
xs: data["lassoPoints"]["x"],
ys: data["lassoPoints"]["y"],
},
selector_state: lassoData,
};
} else {
selectorObject = null;
Expand Down
1,256 changes: 624 additions & 632 deletions plotly/package_data/widgetbundle.js

Large diffs are not rendered by default.