@@ -209,15 +209,24 @@ def iplot_mpl(fig, resize=True, strip_style=False, update=None, **plot_options):
209
209
Keyword arguments:
210
210
resize (default=True) -- allow plotly to choose the figure size
211
211
strip_style (default=False) -- allow plotly to choose style options
212
+ update (default=None) -- update the resulting figure with an 'update'
213
+ dictionary-like object resembling a plotly 'Figure' object
212
214
213
215
Additional keyword arguments:
214
216
plot_options -- run help(plotly.plotly.iplot)
215
217
216
218
"""
217
219
fig = tools .mpl_to_plotly (fig , resize = resize , strip_style = strip_style )
218
220
if update :
219
- update_fig = tools .get_valid_graph_obj (update , 'Figure' )
220
- fig .update (update_fig )
221
+ try :
222
+ update_fig = tools .get_valid_graph_obj (update , 'Figure' )
223
+ except exceptions .PlotlyGraphObjectError as err :
224
+ err .add_note ("Your update figure could not be properly converted "
225
+ "into a plotly 'Figure' graph object." )
226
+ err .prepare ()
227
+ raise
228
+ else :
229
+ fig .update (update_fig )
221
230
return iplot (fig , ** plot_options )
222
231
223
232
@@ -235,15 +244,24 @@ def plot_mpl(fig, resize=True, strip_style=False, update=None, **plot_options):
235
244
Keyword arguments:
236
245
resize (default=True) -- allow plotly to choose the figure size
237
246
strip_style (default=False) -- allow plotly to choose style options
247
+ update (default=None) -- update the resulting figure with an 'update'
248
+ dictionary-like object resembling a plotly 'Figure' object
238
249
239
250
Additional keyword arguments:
240
251
plot_options -- run help(plotly.plotly.plot)
241
252
242
253
"""
243
254
fig = tools .mpl_to_plotly (fig , resize = resize , strip_style = strip_style )
244
255
if update :
245
- update_fig = tools .get_valid_graph_obj (update , 'Figure' )
246
- fig .update (update_fig )
256
+ try :
257
+ update_fig = tools .get_valid_graph_obj (update , 'Figure' )
258
+ except exceptions .PlotlyGraphObjectError as err :
259
+ err .add_note ("Your update figure could not be properly converted "
260
+ "into a plotly 'Figure' graph object." )
261
+ err .prepare ()
262
+ raise
263
+ else :
264
+ fig .update (update_fig )
247
265
return plot (fig , ** plot_options )
248
266
249
267
0 commit comments