Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9dda79c

Browse filesBrowse files
committed
Merge pull request #18454 from QuLogic/fix-nbagg-rerun
FIX: Use OutputArea event to trigger figure close in nbagg
1 parent eea9f63 commit 9dda79c
Copy full SHA for 9dda79c

File tree

Expand file treeCollapse file tree

2 files changed

+13
-5
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-5
lines changed

‎lib/matplotlib/backends/web_backend/js/nbagg_mpl.js

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/web_backend/js/nbagg_mpl.js
+12-4Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,19 @@ mpl.mpl_figure_comm = function (comm, msg) {
4848
console.error('Failed to find cell for figure', id, fig);
4949
return;
5050
}
51+
fig.cell_info[0].output_area.element.one(
52+
'cleared',
53+
{ fig: fig },
54+
fig._remove_fig_handler
55+
);
5156
};
5257

5358
mpl.figure.prototype.handle_close = function (fig, msg) {
5459
var width = fig.canvas.width / fig.ratio;
55-
fig.root.removeEventListener('remove', this._remove_fig_handler);
60+
fig.cell_info[0].output_area.element.off(
61+
'cleared',
62+
fig._remove_fig_handler
63+
);
5664

5765
// Update the output cell to use the data from the current canvas.
5866
fig.push_to_output();
@@ -171,13 +179,13 @@ mpl.figure.prototype._init_toolbar = function () {
171179
titlebar.insertBefore(buttongrp, titlebar.firstChild);
172180
};
173181

174-
mpl.figure.prototype._remove_fig_handler = function () {
175-
this.close_ws(this, {});
182+
mpl.figure.prototype._remove_fig_handler = function (event) {
183+
var fig = event.data.fig;
184+
fig.close_ws(fig, {});
176185
};
177186

178187
mpl.figure.prototype._root_extra_style = function (el) {
179188
el.style.boxSizing = 'content-box'; // override notebook setting of border-box.
180-
el.addEventListener('remove', this._remove_fig_handler);
181189
};
182190

183191
mpl.figure.prototype._canvas_extra_style = function (el) {

‎requirements/testing/travis_extra.txt

Copy file name to clipboardExpand all lines: requirements/testing/travis_extra.txt
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Extra pip requirements for the travis python 3.7+ builds
22

33
ipykernel
4-
nbconvert[execute]
4+
nbconvert[execute]!=6.0.0,!=6.0.1
55
nbformat!=5.0.0,!=5.0.1
66
pandas!=0.25.0
77
pikepdf

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.