Skip to content

DOC fix DecisionBoundaryDisplay color consistency in plot_sgd_iris example - #33719

Merged
jeremiedbb merged 3 commits into
scikit-learn:mainfrom
anvaybarhate-ux:doc/fix-sgd-iris-decision-boundary-colors
Apr 23, 2026
Merged

jeremiedbb merged 3 commits into
scikit-learn:mainfrom
anvaybarhate-ux:doc/fix-sgd-iris-decision-boundary-colors

Conversation

@anvaybarhate-ux

@anvaybarhate-ux anvaybarhate-ux commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

Towards #33557

Changes

  • Replaced cmap=plt.cm.Paired with multiclass_colors=["b", "r", "y"]
    in DecisionBoundaryDisplay.from_estimator to ensure colour consistency
    between decision boundary regions and scatter points for this 3-class problem.

Visual verification

Decision boundary colours now match scatter point colours:

  • Blue region → setosa (blue dots)
  • Red region → versicolor (red dots)
  • Yellow region → virginica (yellow dots)

@AnneBeyer

Copy link
Copy Markdown
Member

Hi @anvaybarhate-ux, thank you for this PR, but looking at the output, the filled regions are now the same color as the dahed lines of the OVA classifiers, which make them invisible in parts of the plot.

image

Once #33709 is merged, this example can simply be fixed by adapting the code to use multiclass_colors=plt.cm.Paired, so please wait on this one for now.

@AnneBeyer

Copy link
Copy Markdown
Member

Fixes #33557

Also, please note that this part in your PR description will automatically close the whole issue if it gets merged, even though it only fixes a part of it. Please change it to "Towards #33557" (see 2. in the Pull Request Checklist)

@anvaybarhate-ux

Copy link
Copy Markdown
Contributor Author

Thanks @AnneBeyer! I have updated the description to 'Towards #33557'. I will wait for #33709 to merge and then update the color fix accordingly.

@AnneBeyer AnneBeyer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @anvaybarhate-ux, thank you for your patience! #33709 is now merged and we have a new default for colors. Please add the suggested changes and check the newly generated output. Thank you!

Comment thread examples/linear_model/plot_sgd_iris.py Resolved
Comment thread examples/linear_model/plot_sgd_iris.py Resolved
@anvaybarhate-ux

Copy link
Copy Markdown
Contributor Author

Thanks @AnneBeyer! Removed( multiclass_colors ) entirely so the new default color map is used, and updated colors to "byr". All dashed lines are now clearly visible. Please let me know if anything else needs adjusting.

@AnneBeyer AnneBeyer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @anvaybarhate-ux, LGTM!
This is the new output:

Image

@ogrisel, could we merge this?

@AnneBeyer AnneBeyer added this to Labs Apr 23, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Labs Apr 23, 2026
@AnneBeyer AnneBeyer moved this from Todo to In progress in Labs Apr 23, 2026

@jeremiedbb jeremiedbb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

@jeremiedbb
jeremiedbb merged commit 8ad2414 into scikit-learn:main Apr 23, 2026
33 checks passed
@github-project-automation github-project-automation Bot moved this from In progress to Done in Labs Apr 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants