diff --git a/examples/miscellaneous/plot_outlier_detection_bench.py b/examples/miscellaneous/plot_outlier_detection_bench.py index 600eceb1a06b3..933902500ef8b 100644 --- a/examples/miscellaneous/plot_outlier_detection_bench.py +++ b/examples/miscellaneous/plot_outlier_detection_bench.py @@ -355,8 +355,7 @@ def fit_predict(estimator, X): ax=ax, plot_chance_level=(model_idx == len(n_neighbors_list) - 1), chance_level_kw={"linestyle": (0, (1, 10))}, - linestyle=linestyle, - linewidth=2, + curve_kwargs=dict(linestyle=linestyle, linewidth=2), ) _ = ax.set_title("RobustScaler with varying n_neighbors\non forestcover dataset") @@ -395,8 +394,7 @@ def fit_predict(estimator, X): ax=ax, plot_chance_level=(model_idx == len(preprocessor_list) - 1), chance_level_kw={"linestyle": (0, (1, 10))}, - linestyle=linestyle, - linewidth=2, + curve_kwargs=dict(linestyle=linestyle, linewidth=2), ) _ = ax.set_title("Fixed n_neighbors with varying preprocessing\non forestcover dataset") @@ -447,8 +445,7 @@ def fit_predict(estimator, X): ax=ax, plot_chance_level=(model_idx == len(preprocessor_list) - 1), chance_level_kw={"linestyle": (0, (1, 10))}, - linestyle=linestyle, - linewidth=2, + curve_kwargs=dict(linestyle=linestyle, linewidth=2), ) ax.set_title( "Fixed n_neighbors with varying preprocessing\non cardiotocography dataset" diff --git a/examples/miscellaneous/plot_roc_curve_visualization_api.py b/examples/miscellaneous/plot_roc_curve_visualization_api.py index d377d321e061e..1aacbd9de3631 100644 --- a/examples/miscellaneous/plot_roc_curve_visualization_api.py +++ b/examples/miscellaneous/plot_roc_curve_visualization_api.py @@ -54,6 +54,8 @@ rfc = RandomForestClassifier(n_estimators=10, random_state=42) rfc.fit(X_train, y_train) ax = plt.gca() -rfc_disp = RocCurveDisplay.from_estimator(rfc, X_test, y_test, ax=ax, alpha=0.8) -svc_disp.plot(ax=ax, alpha=0.8) +rfc_disp = RocCurveDisplay.from_estimator( + rfc, X_test, y_test, ax=ax, curve_kwargs=dict(alpha=0.8) +) +svc_disp.plot(ax=ax, curve_kwargs=dict(alpha=0.8)) plt.show() diff --git a/examples/model_selection/plot_cost_sensitive_learning.py b/examples/model_selection/plot_cost_sensitive_learning.py index 9845d27661374..6b5b651463b05 100644 --- a/examples/model_selection/plot_cost_sensitive_learning.py +++ b/examples/model_selection/plot_cost_sensitive_learning.py @@ -321,8 +321,7 @@ def plot_roc_pr_curves(vanilla_model, tuned_model, *, title): X_test, y_test, pos_label=pos_label, - linestyle=linestyle, - color=color, + curve_kwargs=dict(linestyle=linestyle, color=color), ax=axs[1], name=name, plot_chance_level=idx == 1, diff --git a/examples/model_selection/plot_det.py b/examples/model_selection/plot_det.py index 873d00d696d95..4a22cdcd44eb8 100644 --- a/examples/model_selection/plot_det.py +++ b/examples/model_selection/plot_det.py @@ -103,7 +103,12 @@ ) clf.fit(X_train, y_train) RocCurveDisplay.from_estimator( - clf, X_test, y_test, ax=ax_roc, name=name, color=color, linestyle=linestyle + clf, + X_test, + y_test, + ax=ax_roc, + name=name, + curve_kwargs=dict(color=color, linestyle=linestyle), ) DetCurveDisplay.from_estimator( clf, X_test, y_test, ax=ax_det, name=name, color=color, linestyle=linestyle diff --git a/examples/model_selection/plot_roc.py b/examples/model_selection/plot_roc.py index a482ad5f4ab95..9e659b9a2aa64 100644 --- a/examples/model_selection/plot_roc.py +++ b/examples/model_selection/plot_roc.py @@ -129,7 +129,7 @@ y_onehot_test[:, class_id], y_score[:, class_id], name=f"{class_of_interest} vs the rest", - color="darkorange", + curve_kwargs=dict(color="darkorange"), plot_chance_level=True, despine=True, ) @@ -165,7 +165,7 @@ y_onehot_test.ravel(), y_score.ravel(), name="micro-average OvR", - color="darkorange", + curve_kwargs=dict(color="darkorange"), plot_chance_level=True, despine=True, ) @@ -290,7 +290,7 @@ y_onehot_test[:, class_id], y_score[:, class_id], name=f"ROC curve for {target_names[class_id]}", - color=color, + curve_kwargs=dict(color=color), ax=ax, plot_chance_level=(class_id == 2), despine=True, diff --git a/examples/model_selection/plot_roc_crossval.py b/examples/model_selection/plot_roc_crossval.py index fb6432a71ed79..868454626451c 100644 --- a/examples/model_selection/plot_roc_crossval.py +++ b/examples/model_selection/plot_roc_crossval.py @@ -89,8 +89,7 @@ X[test], y[test], name=f"ROC fold {fold}", - alpha=0.3, - lw=1, + curve_kwargs=dict(alpha=0.3, lw=1), ax=ax, plot_chance_level=(fold == n_splits - 1), )