Conversation
lmplot registers a marker in ``hue_kws`` even without a hue mapping, and ``FacetGrid.map`` unconditionally injects those aesthetics into whatever function it is given. refline was calling ``self.map(plt.axvline, ...)``, so reference lines ended up with a ``marker`` attribute and drew dots at both ends. Draw the reference lines directly on each facet axis instead, preserving the hue-mapped color behavior via ``_facet_color`` when ``color=None``. Closes GH#3973
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes
Fixes #3973
Problem
lmplotregisters a marker aesthetic inFacetGrid.hue_kws(even when there is no hue mapping), andFacetGrid.mapunconditionally injects everyhue_kwsentry into the mapped function. SinceFacetGrid.reflinedraws its reference lines viaself.map(plt.axvline / plt.axhline, ...), the marker rides along into a function that never asked for it, andaxvline/axhlinedraw a dot at both ends of the reference line:Change
Draw the reference lines directly on each facet axis instead of routing them through
map(), sohue_kwsaesthetics (markers, etc.) are never injected intoaxvline/axhline. Thecolor=Nonehue-mapping behavior is preserved through_facet_color, which now resolves the per-hue palette color.Validation
test_refline_no_hue_kwsasserts:lmplot().refline()carry no marker;refline(color=None)still draws each line in its hue's palette color.tests/test_axisgrid.py: 124 passed.tests/test_regression.py: 52 passed, 9 skipped (unrelated).Note: this change was prepared with AI assistance; the root-cause analysis and the approach (bypass
map()inrefline, keepmap()'shue_kwsinjection intact for data-mapped functions) were reviewed and validated locally against the seaborn test suite.