Skip to content

DOC fix colors and typos in example on Multinomial and One-vs-Rest Decision Boundaries - #33622

Merged
adrinjalali merged 3 commits into
scikit-learn:mainfrom
AnneBeyer:dbd_fix_example_plot_logistic_multinomial
Mar 27, 2026
Merged

adrinjalali merged 3 commits into
scikit-learn:mainfrom
AnneBeyer:dbd_fix_example_plot_logistic_multinomial

Conversation

@AnneBeyer

@AnneBeyer AnneBeyer commented Mar 24, 2026 •

Copy link
Copy Markdown
Member

Reference Issues/PRs

Towards #33557

What does this implement/fix? Explain your changes.

Fixes the color inconsistency between scatter plot and decision boundary/hyperplanes in the example on Decision Boundaries of Multinomial and One-vs-Rest Logistic Regression (plot_logistic_multinomial.py) to use the first three colors of the "tab10" colormap consistently throughout the example. (This was set as the default for the DecisionBoundaryDisplay for multiclass with < 10 classes.)
EDIT: After consulting with @adrinjalali, I changed it to use the coolwarm colormap, as orange and green can be hard to distinguishable in the scatterplot and hyperplanes (see also https://www.color-blindness.com/coblis-color-blindness-simulator/).

From
image
to
image
and
image
and
image

AI usage disclosure

I used AI assistance for:

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Any other comments?

Also fixes some typos/wording on the side.

from sklearn.datasets import make_blobs

# get the first three colors from the "tab10" colormap for easily distinguishable colors
cmap = mpl.colors.ListedColormap((plt.get_cmap("tab10").colors[:3]))

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This explicit selection is necessary because if we simply specify "tab10", 3 evenly spaced colors will be selected from the colormap by .scatter, leading to inconsistencies with the decision boundary again.

@AnneBeyer AnneBeyer added this to Labs Mar 24, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Labs Mar 24, 2026
@AnneBeyer
AnneBeyer marked this pull request as draft March 26, 2026 10:50
@AnneBeyer
AnneBeyer marked this pull request as ready for review March 27, 2026 12:55
@adrinjalali
adrinjalali merged commit d2cba09 into scikit-learn:main Mar 27, 2026
33 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Labs Mar 27, 2026
@AnneBeyer
AnneBeyer deleted the dbd_fix_example_plot_logistic_multinomial branch April 15, 2026 19:06
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.

2 participants