Draw connector lines below their points instead of on top#42
Open
cduvallet wants to merge 2 commits into
Open
Conversation
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Owner
|
Thank you, good catch! I like changing the default value, but I feel like adding more parameters is not necessary since one can change the setting via plot_kwargs (linewidth is probably also redundant...). Suggestions:
What do you think? |
Fold the below-point zorder default directly into line_kwargs instead of exposing a separate linezorder parameter — plot_kwargs remains the one escape hatch for overriding it. Also reverts demo.ipynb and drops the added images per review feedback.
Author
|
All great points, and implemented! I also updated the plot_kwargs docstring to (1) mention zorder and (2) make it explicit that plot_kwargs overrides provided params (e.g. linewidth). As a user, I appreciate having linewidth as an easily accessible parameter, so while it is technically redundant I would keep it in :) |
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.
Summary
Connector lines drawn by
allocate()went to thecenter of each point, using matplotlib's default zorder (2), which
is above the default zorder for scatter/patch collections (1). This
made the line color show through the point marker instead of
tucking behind it.
This PR adds a
linezorderparam toallocate(). It defaults toNone,which resolves to a value below the point's zorder (further lowered
to stay below
scatter_plot's own zorder if provided) so the pointvisually caps the line where it meets it. An explicit
linezorder(or
plot_kwargs={"zorder": ...}) overrides this.Also adds an example to the demo notebook.
Before / after
Before:

After:

Test plan
behind points by default, both with and without
scatter_plotpassed.
linezorderandplot_kwargs={"zorder": ...}overrides are respected even when
scatter_plotis provided.demo.ipynbshowing default vs.overridden
linezorderbehavior.