You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR makes sizelegend line up with scatter marker sizing without forcing users to manually reconstruct UltraPlot’s size-scaling rules. Scatter collections now retain their effective size-scale metadata, and sizelegend() can reuse that information by default to infer matching legend marker sizes from an existing compatible scatter plot, while still allowing explicit overrides and preserving direct area=True / area=False behavior when requested. The change also adds regression coverage for absolute- size, scaled-size, compatibility fallback, and explicit override cases so the legend behavior stays predictable.
ax.plot(..., m='.', ms=50) creates a Line2D point with marker '.' and markersize=50, but your sizelegend([50, 25], area=False) is building semantic legend entries with the default marker 'o'. Numerically the first legend handle is 50 pt, but it is marker='o', not marker='.', so it renders differently and looks wrong for that plot.
ax.plot(..., m='.', ms=50) creates a Line2D point with marker '.' and markersize=50, but your sizelegend([50, 25], area=False) is building semantic legend entries with the default marker 'o'. Numerically the first legend handle is 50 pt, but it is marker='o', not marker='.', so it renders differently and looks wrong for that plot.
Oh, despite using matplotlib for a long time, I didn't realize '.' and 'o' are different markers. I mistakenly thought they were the same. My bad! Sorry to bother.
No bother, but is this PR more what you had in mind? Then can proceed to merge and draft a release.
EDIT: I am not that opinionated in this area as I don't really use these kind of legends, so I take your feedback to hearth.
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
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.
How about this @gepcel ?
This PR makes sizelegend line up with scatter marker sizing without forcing users to manually reconstruct UltraPlot’s size-scaling rules. Scatter collections now retain their effective size-scale metadata, and sizelegend() can reuse that information by default to infer matching legend marker sizes from an existing compatible scatter plot, while still allowing explicit overrides and preserving direct area=True / area=False behavior when requested. The change also adds regression coverage for absolute- size, scaled-size, compatibility fallback, and explicit override cases so the legend behavior stays predictable.