-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
allow fillstyle 'none' option #447
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
Conversation
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
You have 7 or so lines which read "if fs == 'full' or fs == 'none':" in markers.py. This looks like a good candidate for a local function. |
If you wouldn't mind incorporating @jdh2358's suggestion, I think this pull would be ready to merge. |
Conflicts: lib/matplotlib/lines.py lib/matplotlib/markers.py
tacaswell
added a commit
to tacaswell/matplotlib
that referenced
this pull request
Nov 24, 2020
This is brittle, but matches the behavior in Line2D. MarkerStyle objects have two coupled, but not fully redundant methods for determining if the maker is filled: the `is_filled` and `get_fillstyle` methods. If `ms.get_fillstyle() == 'none'` then `ms.is_filled() is False`, however the converse is not True. In particular the markers that can not be filled (because the Paths they are made out of can not be closed) have `ms.get_fillstyle() == 'full'` and `ms.is_filled() is False`. In Line2D we filter on the value of `get_fillstyle` not on `is_filled` so do the same in `Axes.scatter`. In Line2D we do the validation at draw time (because Line2D holds onto its MarkerStyle object instead of just extracting the path). The logic for fillstyle on Markers came in via matplotlib#447/ 213459e. closes matplotlib#17849 Revises matplotlib#17543 / d86cc2b
tacaswell
added a commit
to tacaswell/matplotlib
that referenced
this pull request
Nov 24, 2020
This is brittle, but matches the behavior in Line2D. MarkerStyle objects have two coupled, but not fully redundant methods for determining if the maker is filled: the `is_filled` and `get_fillstyle` methods. If `ms.get_fillstyle() == 'none'` then `ms.is_filled() is False`, however the converse is not True. In particular the markers that can not be filled (because the Paths they are made out of can not be closed) have `ms.get_fillstyle() == 'full'` and `ms.is_filled() is False`. In Line2D we filter on the value of `get_fillstyle` not on `is_filled` so do the same in `Axes.scatter`. In Line2D we do the validation at draw time (because Line2D holds onto its MarkerStyle object instead of just extracting the path). The logic for fillstyle on Markers came in via matplotlib#447/ 213459e. closes matplotlib#17849 Revises matplotlib#17543 / d86cc2b
tacaswell
added a commit
to tacaswell/matplotlib
that referenced
this pull request
Jan 21, 2021
This is brittle, but matches the behavior in Line2D. MarkerStyle objects have two coupled, but not fully redundant methods for determining if the maker is filled: the `is_filled` and `get_fillstyle` methods. If `ms.get_fillstyle() == 'none'` then `ms.is_filled() is False`, however the converse is not True. In particular the markers that can not be filled (because the Paths they are made out of can not be closed) have `ms.get_fillstyle() == 'full'` and `ms.is_filled() is False`. In Line2D we filter on the value of `get_fillstyle` not on `is_filled` so do the same in `Axes.scatter`. In Line2D we do the validation at draw time (because Line2D holds onto its MarkerStyle object instead of just extracting the path). The logic for fillstyle on Markers came in via matplotlib#447/ 213459e. closes matplotlib#17849 Revises matplotlib#17543 / d86cc2b
tacaswell
added a commit
to tacaswell/matplotlib
that referenced
this pull request
Jan 22, 2021
This is brittle, but matches the behavior in Line2D. MarkerStyle objects have two coupled, but not fully redundant methods for determining if the maker is filled: the `is_filled` and `get_fillstyle` methods. If `ms.get_fillstyle() == 'none'` then `ms.is_filled() is False`, however the converse is not True. In particular the markers that can not be filled (because the Paths they are made out of can not be closed) have `ms.get_fillstyle() == 'full'` and `ms.is_filled() is False`. In Line2D we filter on the value of `get_fillstyle` not on `is_filled` so do the same in `Axes.scatter`. In Line2D we do the validation at draw time (because Line2D holds onto its MarkerStyle object instead of just extracting the path). The logic for fillstyle on Markers came in via matplotlib#447/ 213459e. closes matplotlib#17849 Revises matplotlib#17543 / d86cc2b Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
tacaswell
added a commit
to tacaswell/matplotlib
that referenced
this pull request
Jan 29, 2021
This is brittle, but matches the behavior in Line2D. MarkerStyle objects have two coupled, but not fully redundant methods for determining if the maker is filled: the `is_filled` and `get_fillstyle` methods. If `ms.get_fillstyle() == 'none'` then `ms.is_filled() is False`, however the converse is not True. In particular the markers that can not be filled (because the Paths they are made out of can not be closed) have `ms.get_fillstyle() == 'full'` and `ms.is_filled() is False`. In Line2D we filter on the value of `get_fillstyle` not on `is_filled` so do the same in `Axes.scatter`. In Line2D we do the validation at draw time (because Line2D holds onto its MarkerStyle object instead of just extracting the path). The logic for fillstyle on Markers came in via matplotlib#447/ 213459e. closes matplotlib#17849 Revises matplotlib#17543 / d86cc2b Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Co-authored-by: Jody Klymak <jklymak@gmail.com> Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com>
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.
The fillstyle property currently allows full- and half-filling (top|bottom|left|right) of relevant markers. To the best of my understanding, creating an unfilled (i.e. just an outline) marker currently requires setting markerfacecolor to 'none' and markeredgecolor to the color of your choice (if you don't want black).
In the interest of consistency, I added a fillstyle 'none' option to allow creation of unfilled markers using the same interface as the other filling options.
In this implementation, when fillstyle=='none' and markerfacecolor == 'auto', the color returned by _get_markerfacecolor is 'none', as opposed to self._color in the original code. Similarly, when fillstyle=='none' and markeredgecolor == 'auto', the color returned by get_markeredgecolor is self._color, rather than 'k'.
Note that this means setting markerfacecolor to something other than 'none' or 'auto' will generally result in a filled marker even when fillstyle=='none'. Giving fillstyle priority when returning markerfacecolor was another option, but I wasn't comfortable with masking a manual setting. There may exist better ways to handle this.