3232from ._util import OptimizeResult , _SklearnLikeRegressor
3333
3434_MARKER_SEQUENCE = 'osxdvP^'
35-
35+ _DEFAULT_SUBPLOT_SIZE = 2.1
3636
3737def plot_convergence (
3838 * results : OptimizeResult | tuple [str , OptimizeResult ],
@@ -245,7 +245,7 @@ def _format_scatter_plot_axes(fig, axs, space, plot_dims=None, dim_labels=None,
245245 if dim_labels is None :
246246 dim_labels = [fr"$\mathbf{{x_{{{ i } }}}}$" for i in plot_dims ]
247247
248- nticks = int ((1 + np .log10 (size / (base_figsize := 2 ))) * (base_nticks := 6 )) # noqa: F841
248+ nticks = int ((1 + np .log10 (size / (base_figsize := _DEFAULT_SUBPLOT_SIZE ))) * (base_nticks := 6 )) # noqa: F841
249249 fontsize = 10
250250
251251 _MaxNLocator = partial (MaxNLocator , nbins = nticks )
@@ -441,9 +441,9 @@ def _subplots_grid(n_dims, size, title):
441441 _watermark (fig )
442442 if add_figure_title :
443443 fig .suptitle (title )
444- margins = dict (left = (m := 3 / n_dims * size / 2 * .07 ), bottom = m , right = 1 - m ,
444+ margins = dict (left = (m := 3 / n_dims * size / _DEFAULT_SUBPLOT_SIZE * .07 ), bottom = m , right = 1 - m ,
445445 top = 1 - (2 if add_figure_title else 1.1 ) * m )
446- fig .subplots_adjust (** margins , hspace = .15 , wspace = .15 )
446+ fig .subplots_adjust (** margins , hspace = .1 , wspace = .1 )
447447 return fig , axs
448448
449449
@@ -470,7 +470,7 @@ def plot_objective(
470470 resolution : int = 16 ,
471471 n_samples : int = 250 ,
472472 estimator : Optional [str | _SklearnLikeRegressor ] = None ,
473- size : float = 2 ,
473+ size : float = _DEFAULT_SUBPLOT_SIZE ,
474474 zscale : Literal ['linear' , 'log' ] = 'linear' ,
475475 names : Optional [list [str ]] = None ,
476476 true_minimum : Optional [list [float ] | list [list [float ]]] = None ,
@@ -609,8 +609,9 @@ def plot_objective(
609609 if estimator is None and result_estimator is not None :
610610 estimator = result_estimator
611611 else :
612+ _estimator_arg = estimator
612613 estimator = _estimator_factory (estimator , bounds , rng = 0 )
613- if result_estimator is None :
614+ if result_estimator is None and _estimator_arg is None :
614615 warnings .warn (
615616 'The optimization result process does not appear to have been '
616617 'driven by a model. You can still still observe partial dependence '
@@ -654,7 +655,7 @@ def plot_evaluations(
654655 names : Optional [list [str ]] = None ,
655656 plot_dims : Optional [list [int ]] = None ,
656657 jitter : float = .02 ,
657- size : int = 2 ,
658+ size : int = _DEFAULT_SUBPLOT_SIZE ,
658659 cmap : str = 'summer' ,
659660) -> Figure :
660661 """Visualize the order in which points were evaluated during optimization.
0 commit comments