Add zorder option in QuiverKey by muchojp · Pull Request #23116 · matplotlib/matplotlib · GitHub
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions doc/api/next_api_changes/behavior/23116-YN.rst
9 changes: 7 additions & 2 deletions lib/matplotlib/quiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ class QuiverKey(martist.Artist):

def __init__(self, Q, X, Y, U, label,
*, angle=0, coordinates='axes', color=None, labelsep=0.1,
labelpos='N', labelcolor=None, fontproperties=None, **kwargs):
labelpos='N', labelcolor=None, fontproperties=None,
zorder=None, **kwargs):
"""
Add a key to a quiver plot.

Expand Down Expand Up @@ -285,6 +286,8 @@ def __init__(self, Q, X, Y, U, label,
A dictionary with keyword arguments accepted by the
`~matplotlib.font_manager.FontProperties` initializer:
*family*, *style*, *variant*, *size*, *weight*.
zorder : float
The zorder of the key. The default is 0.1 above *Q*.
**kwargs
Any additional keyword arguments are used to override vector
properties taken from *Q*.
Expand Down Expand Up @@ -312,7 +315,9 @@ def __init__(self, Q, X, Y, U, label,
if self.labelcolor is not None:
self.text.set_color(self.labelcolor)
self._dpi_at_last_init = None
self.zorder = Q.zorder + 0.1
self.zorder = zorder
if self.zorder is None:
self.zorder = Q.zorder + 0.1

@property
def labelsep(self):
Expand Down
1 change: 1 addition & 0 deletions lib/matplotlib/quiver.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class QuiverKey(martist.Artist):
labelpos: Literal["N", "S", "E", "W"] = ...,
labelcolor: ColorType | None = ...,
fontproperties: dict[str, Any] | None = ...,
zorder: float | None = ...,
**kwargs
) -> None: ...
@property
Expand Down
91 changes: 91 additions & 0 deletions lib/matplotlib/tests/test_quiver.py