Skip to content

Cycle only over filled markers for default artist style - #591

Open
SimonHeybrock wants to merge 1 commit into
mainfrom
590-cycle-only-valid-markers
Open

Cycle only over filled markers for default artist style#591
SimonHeybrock wants to merge 1 commit into
mainfrom
590-cycle-only-valid-markers

Conversation

@SimonHeybrock

@SimonHeybrock SimonHeybrock commented Jul 28, 2026

Copy link
Copy Markdown
Member

Fixes #590.

Plotting 24 or more lines (e.g. from sc.collapse) raised AttributeError: 'int' object has no attribute 'lower'. The default marker was cycled over Line2D.markers, which is the full marker registry rather than a list of usable plot markers: it contains the integer tick and caret markers, and four entries that draw nothing. Beyond 34 artists the markers would have been invisible rather than raising.

Cycling over Line2D.filled_markers instead. The shared helper lives in the matplotlib backend utils, since lines and scatter points used the same expression.

On the + 2 offset that was there before: it dates back to the initial import and was never touched since, so there is no recorded intent. What it does is skip '.' and ',', the first two entries of Line2D.markers, so that the cycle starts at 'o'. The new + 1 offset into filled_markers preserves that, and artists 0-4 get the same markers as before. From artist 5 onwards the unfilled markers ('1' '2' '3' '4' '+' 'x' '|' '_') are now skipped; those are the ones that make matplotlib warn when the mask overlay sets an edgecolor, so masks on such lines could not be highlighted as intended. The cycle is 16 long instead of 41, so markers repeat sooner, but colors already repeat every 10.

Test plan

  • New regression tests fail on main and pass here.
  • Existing test suite passes.

`Line2D.markers` is the full marker registry, not a list of usable plot
markers: it contains the integer tick and caret markers, as well as markers
that draw nothing. Plotting 24 or more lines thus picked an integer marker,
raising `AttributeError: 'int' object has no attribute 'lower'`, and 35 or
more lines would have silently produced invisible artists.

Fixes #590

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@SimonHeybrock
SimonHeybrock marked this pull request as draft July 28, 2026 08:59
@SimonHeybrock
SimonHeybrock marked this pull request as ready for review July 28, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plotting 24 or more lines raises AttributeError: 'int' object has no attribute 'lower'

2 participants