Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b933cfd

Browse files
committed
fix find_output_cell for IPython >= 3.0
output mime-type keys moved from top-level to a `data` attribute.
1 parent c47de0e commit b933cfd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/matplotlib/backends/web_backend/nbagg_mpl.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,15 @@ mpl.find_output_cell = function(html_output) {
160160
var ncells = cells.length;
161161
for (var i=0; i<ncells; i++) {
162162
var cell = cells[i];
163-
if (cell.cell_type == 'code'){
163+
if (cell.cell_type === 'code'){
164164
for (var j=0; j<cell.output_area.outputs.length; j++) {
165165
var data = cell.output_area.outputs[j];
166-
if (cell.output_area.outputs[j]['text/html'] == html_output) {
167-
var output = cell.output_area.outputs[j];
168-
return [cell, output, j];
166+
if (data.data) {
167+
// IPython >= 3 moved mimebundle to data attribute of output
168+
data = data.data;
169+
}
170+
if (data['text/html'] == html_output) {
171+
return [cell, data, j];
169172
}
170173
}
171174
}

0 commit comments

Comments
 (0)