File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
lib/matplotlib/backends/web_backend Expand file tree Collapse file tree 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) {
4444
4545 fig . parent_element = element . get ( 0 ) ;
4646 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+ }
4751
4852 var output_index = fig . cell_info [ 2 ]
4953 var cell = fig . cell_info [ 0 ] ;
@@ -160,12 +164,15 @@ mpl.find_output_cell = function(html_output) {
160164 var ncells = cells . length ;
161165 for ( var i = 0 ; i < ncells ; i ++ ) {
162166 var cell = cells [ i ] ;
163- if ( cell . cell_type == 'code' ) {
167+ if ( cell . cell_type === 'code' ) {
164168 for ( var j = 0 ; j < cell . output_area . outputs . length ; j ++ ) {
165169 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 ] ;
169176 }
170177 }
171178 }
You can’t perform that action at this time.
0 commit comments