@@ -471,17 +471,17 @@ def draw_title(bricks, gori, gcp, figsize):
471471 position_dict [key ] = axtmp .get_position ()
472472
473473 gcp = copy .deepcopy (ggplot )
474- fig , gcp = gcp .draw (return_ggplot = True )
475-
476474 if StrictVersion (plotnine_version ) >= StrictVersion ("0.12" ):
477475 figure_subplot_wspace_ori = matplotlib .rcParams ["figure.subplot.wspace" ]
478476 figure_subplot_hspace_ori = matplotlib .rcParams ["figure.subplot.hspace" ]
479477 figsize_ori = gcp .theme .themeables ['figure_size' ].properties ["value" ]
480- if figsize is None :
481- figsize = gcp .theme .themeables ['figure_size' ].properties ["value" ]
482478 matplotlib .rcParams ["figure.subplot.wspace" ] = figure_subplot_wspace_ori / figsize [0 ]
483479 matplotlib .rcParams ["figure.subplot.hspace" ] = figure_subplot_hspace_ori / figsize [1 ]
480+ fig , gcp = gcp .draw (return_ggplot = True )
481+ if figsize is None :
482+ figsize = gcp .theme .themeables ['figure_size' ].properties ["value" ]
484483 else :
484+ fig , gcp = gcp .draw (return_ggplot = True )
485485 _themeable = fig ._themeable
486486 _basefigure ._themeable = _themeable
487487 figsize_ori = fig .get_size_inches ()
@@ -523,7 +523,7 @@ def draw_title(bricks, gori, gcp, figsize):
523523 ggplot .axs [i ].spines [bar ].set_lw (gcp .axs [i ].spines [bar ].get_lw ())
524524 ggplot .axs [i ].spines [bar ].set_ec (gcp .axs [i ].spines [bar ].get_ec ())
525525 ggplot .axs [i ].spines [bar ].set_visible (gcp .axs [i ].spines [bar ].get_visible ())
526-
526+
527527 ggplot ._setup_parameters ()
528528 ggplot .facet .strips .generate ()
529529 for i in range (len (ggplot .facet .strips )):
@@ -607,6 +607,10 @@ def draw_title(bricks, gori, gcp, figsize):
607607 for key in tmp_axes_keys :
608608 axtmp = _axes_dict [key ]
609609 axtmp .set_position (position_dict [key ])
610+
611+ if StrictVersion (plotnine_version ) >= StrictVersion ("0.12" ):
612+ matplotlib .rcParams ["figure.subplot.wspace" ] = figure_subplot_wspace_ori
613+ matplotlib .rcParams ["figure.subplot.hspace" ] = figure_subplot_hspace_ori
610614 return ax
611615
612616 else :
0 commit comments