File tree 1 file changed +11
-4
lines changed
lib/matplotlib/backends/web_backend
1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ mpl.mpl_figure_comm = function(comm, msg) {
44
44
45
45
fig . parent_element = element . get ( 0 ) ;
46
46
fig . cell_info = mpl . find_output_cell ( "<div id='" + id + "'></div>" ) ;
47
+ if ( ! fig . cell_info ) {
48
+ console . error ( "Failed to find cell for figure" , id , fig ) ;
49
+ return ;
50
+ }
47
51
48
52
var output_index = fig . cell_info [ 2 ]
49
53
var cell = fig . cell_info [ 0 ] ;
@@ -160,12 +164,15 @@ mpl.find_output_cell = function(html_output) {
160
164
var ncells = cells . length ;
161
165
for ( var i = 0 ; i < ncells ; i ++ ) {
162
166
var cell = cells [ i ] ;
163
- if ( cell . cell_type == 'code' ) {
167
+ if ( cell . cell_type === 'code' ) {
164
168
for ( var j = 0 ; j < cell . output_area . outputs . length ; j ++ ) {
165
169
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 ] ;
170
+ if ( data . data ) {
171
+ // IPython >= 3 moved mimebundle to data attribute of output
172
+ data = data . data ;
173
+ }
174
+ if ( data [ 'text/html' ] == html_output ) {
175
+ return [ cell , data , j ] ;
169
176
}
170
177
}
171
178
}
You can’t perform that action at this time.
0 commit comments