File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -376,13 +376,26 @@ def to_image(
376376 if defaults .mathjax :
377377 kopts ["mathjax" ] = defaults .mathjax
378378
379- # TODO: Refactor to make it possible to use a shared Kaleido instance here
379+
380+ width = (
381+ width
382+ or fig_dict .get ("layout" ).get ("width" )
383+ or fig_dict .get ("layout" ).get ("template" , {}).get ("layout" , {}).get ("width" )
384+ or defaults .default_width
385+ )
386+ height = (
387+ height
388+ or fig_dict .get ("layout" ).get ("height" )
389+ or fig_dict .get ("layout" ).get ("template" , {}).get ("layout" , {}).get ("height" )
390+ or defaults .default_height
391+ )
392+
380393 img_bytes = kaleido .calc_fig_sync (
381394 fig_dict ,
382395 opts = dict (
383396 format = format or defaults .default_format ,
384- width = width or defaults . default_width ,
385- height = height or defaults . default_height ,
397+ width = width ,
398+ height = height ,
386399 scale = scale or defaults .default_scale ,
387400 ),
388401 topojson = defaults .topojson ,
You can’t perform that action at this time.
0 commit comments