Skip to content

Support markevery on figure-level lines. #20670

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 21, 2021

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jul 18, 2021

... except for markevery=<float> or (<float>, <float>) which is a
spec relative to the axes size (keeping handling of that specific case
into _mark_every_path).

The main use case is the monolithic Line2D legend handler proposed in #11358, in combination with figlegend (#11358 (comment), #11358 (comment)): in that case, a line+singlemarker legend entry would be represented using markevery=[1] (which there isn't really a reason not to support).

PR Summary

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

... except for `markevery=<float>` or `(<float>, <float>)` which is a
spec relative to the axes size (keeping handling of that specific case
into _mark_every_path).
@jklymak
Copy link
Member

jklymak commented Jul 21, 2021

Does this need some sort of documentation. I'm being lazy, but I cannot follow what new feature it has actually added.

@anntzer
Copy link
Contributor Author

anntzer commented Jul 21, 2021

I think you should really see this as part of #11358/#20699 (I just wanted to keep #20699 as a clean-ish rebase, if I wrote the original PR probably this would just have been part of it -- so I can also move this to #20699 if you prefer).

The use case is otherwise quite obscure: previously, markevery would never work for figure-level lines (i.e. Line2D who have a .figure but no .axes), whereas now there's only one small case where they don't (i.e., when markevery is defined relative to the parent axes size). Figure-level lines are very rare (hence I don't think it's really worth mentioning this in the docs, that's really just more confusing than anything else), but they are used in Figure.legend, hence the need for the fix.

@jklymak jklymak merged commit 758eb36 into matplotlib:master Jul 21, 2021
@anntzer anntzer deleted the markevery-figure-line branch July 21, 2021 18:41
@QuLogic QuLogic added this to the v3.5.0 milestone Jul 21, 2021
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.

4 participants