Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Boxplot zorder kwarg#7178

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
NelleV merged 4 commits intomatplotlib:masterfrombcongdon:boxplot-zorder
Sep 29, 2016
Merged
Show file tree
Hide file tree
Changes fromall 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
11 changes: 11 additions & 0 deletionsdoc/users/whats_new/boxplot_zorder_kwarg.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
Boxplot Zorder Keyword Argument
-------------------------------

The ``zorder`` parameter now exists for:func:`boxplot`. This allows the zorder
of a boxplot to be set in the plotting function call.

Example
```````
::

boxplot(np.arange(10), zorder=10)
21 changes: 15 additions & 6 deletionslib/matplotlib/axes/_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -3095,7 +3095,7 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
showbox=None, showfliers=None, boxprops=None,
labels=None, flierprops=None, medianprops=None,
meanprops=None, capprops=None, whiskerprops=None,
manage_xticks=True, autorange=False):
manage_xticks=True, autorange=False, zorder=None):
"""
Make a box and whisker plot.

Expand All@@ -3108,7 +3108,7 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
showbox=True, showfliers=True, boxprops=None,
labels=None, flierprops=None, medianprops=None,
meanprops=None, capprops=None, whiskerprops=None,
manage_xticks=True, autorange=False):
manage_xticks=True, autorange=False, zorder=None):

Make a box and whisker plot for each column of ``x`` or each
vector in sequence ``x``. The box extends from the lower to
Expand DownExpand Up@@ -3220,6 +3220,9 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None,
``shownotches`` is also True. Otherwise, means will be shown
as points.

zorder : scalar, optional (None)
Sets the zorder of the boxplot.

Other Parameters
----------------
The following boolean options toggle the drawing of individual
Expand DownExpand Up@@ -3390,15 +3393,15 @@ def _update_dict(dictionary, rc_name, properties):
medianprops=medianprops, meanprops=meanprops,
meanline=meanline, showfliers=showfliers,
capprops=capprops, whiskerprops=whiskerprops,
manage_xticks=manage_xticks)
manage_xticks=manage_xticks, zorder=zorder)
return artists

def bxp(self, bxpstats, positions=None, widths=None, vert=True,
patch_artist=False, shownotches=False, showmeans=False,
showcaps=True, showbox=True, showfliers=True,
boxprops=None, whiskerprops=None, flierprops=None,
medianprops=None, capprops=None, meanprops=None,
meanline=False, manage_xticks=True):
meanline=False, manage_xticks=True, zorder=None):
"""
Drawing function for box and whisker plots.

Expand All@@ -3409,7 +3412,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
showcaps=True, showbox=True, showfliers=True,
boxprops=None, whiskerprops=None, flierprops=None,
medianprops=None, capprops=None, meanprops=None,
meanline=False, manage_xticks=True):
meanline=False, manage_xticks=True, zorder=None):

Make a box and whisker plot for each column of *x* or each
vector in sequence *x*. The box extends from the lower to
Expand DownExpand Up@@ -3513,6 +3516,9 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
manage_xticks : bool, default = True
If the function should adjust the xlim and xtick locations.

zorder : scalar, default = None
The zorder of the resulting boxplot

Returns
-------
result : dict
Expand DownExpand Up@@ -3555,7 +3561,10 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
# empty list of xticklabels
datalabels = []

zorder = mlines.Line2D.zorder
# Use default zorder if none specified
if zorder is None:
zorder = mlines.Line2D.zorder

zdelta = 0.1
# box properties
if patch_artist:
Expand Down
8 changes: 8 additions & 0 deletionslib/matplotlib/tests/test_axes.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2012,6 +2012,14 @@ def test_boxplot_bad_ci_1():
conf_intervals=[[1, 2]])


@cleanup
def test_boxplot_zorder():
x = np.arange(10)
fix, ax = plt.subplots()
assert ax.boxplot(x)['boxes'][0].get_zorder() == 2
assert ax.boxplot(x, zorder=10)['boxes'][0].get_zorder() == 10


@cleanup
def test_boxplot_bad_ci_2():
x = np.linspace(-7, 7, 140)
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp