Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8bf8653
REF/TST: split up boxplot function into a calculator (cbook.boxplot_s…
phobson Nov 29, 2013
b429dcf
BUG: fixed cbook tests for Python 2.6
phobson Dec 2, 2013
04937b5
ENH: allow for custom patch artist and labels to the boxplots
phobson Dec 3, 2013
88435bc
WIP: more tests and add option to toggle box
phobson Dec 3, 2013
1002913
DOC/REF: added docstring for axes.bxp and refactored all references t…
phobson Dec 3, 2013
614736d
REF/TST: update boxplot_stats test with outliers changed to fliers
phobson Dec 3, 2013
ec12ef9
MNT: reran boilerplate.py
phobson Dec 3, 2013
ffdbd7d
DOC: added blurb in changelog
phobson Dec 3, 2013
987893c
MNT: got rid of build-breaking `u''` strings in pyplot
phobson Dec 3, 2013
2562b68
MNT: fixed changelog whitespace
phobson Dec 3, 2013
7f937f9
ENH: cbook.boxplot_stats can now set the whiskers to -range- (min/max…
phobson Dec 3, 2013
fc80458
TST: added tests and baseline images for new whisker behavior
phobson Dec 3, 2013
85d91df
ENH: added remaining bxp kwargs to boxplot
phobson Dec 4, 2013
d079ad2
DOC: expanded boxplot_stats docstring
phobson Dec 4, 2013
5a9f610
DOC: added examples
phobson Dec 4, 2013
13937e9
DOC: impoved example boxplot figure layout and confirmed that they bu…
phobson Dec 16, 2013
eed0ce0
REF/TST: split up boxplot function into a calculator (cbook.boxplot_s…
phobson Nov 29, 2013
91f88a2
BUG: fixed cbook tests for Python 2.6
phobson Dec 2, 2013
65a686c
ENH: allow for custom patch artist and labels to the boxplots
phobson Dec 3, 2013
e9c1c9b
WIP: more tests and add option to toggle box
phobson Dec 3, 2013
f8e7215
DOC/REF: added docstring for axes.bxp and refactored all references t…
phobson Dec 3, 2013
5cc858f
REF/TST: update boxplot_stats test with outliers changed to fliers
phobson Dec 3, 2013
e26b943
MNT: reran boilerplate.py
phobson Dec 3, 2013
38368ae
DOC: added blurb in changelog
phobson Dec 3, 2013
0ad290f
MNT: got rid of build-breaking `u''` strings in pyplot
phobson Dec 3, 2013
858964a
MNT: fixed changelog whitespace
phobson Dec 3, 2013
7cf8b35
ENH: cbook.boxplot_stats can now set the whiskers to -range- (min/max…
phobson Dec 3, 2013
d8da483
TST: added tests and baseline images for new whisker behavior
phobson Dec 3, 2013
d29bcd7
ENH: added remaining bxp kwargs to boxplot
phobson Dec 4, 2013
5ded206
DOC: expanded boxplot_stats docstring
phobson Dec 4, 2013
9b97ac4
DOC: added examples
phobson Dec 4, 2013
676f28e
DOC: impoved example boxplot figure layout and confirmed that they bu…
phobson Dec 16, 2013
954b212
DOC: add a blurb in whats_new about the changes to boxplot
phobson Jan 13, 2014
1532b99
Merge conflicts
phobson Jan 13, 2014
d5edad9
removed extra newline in changlog
phobson Jan 13, 2014
eb56c3b
boxplot default style dicts now updated with user input and better sh…
phobson Jan 17, 2014
d7a4a8c
fixed typo in mean style boxplot updating
phobson Jan 17, 2014
1a06081
added some comments to boxplot
phobson Jan 17, 2014
da97eab
cleanup up typos and minor tweaks based on dev team input
phobson Jan 19, 2014
437f5c2
cleaned up whats_new (thanks, efiring)
phobson Jan 19, 2014
f26a402
better shaping checking logic
phobson Jan 19, 2014
f2aea5b
boxplot and bxp docstrings to a more numpy-like format
phobson Jan 19, 2014
9b0118f
fixed usermedian shape logic (again)
phobson Jan 19, 2014
64b1196
reran boilerplate.py
phobson Jan 23, 2014
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
Prev Previous commit
Next Next commit
ENH: allow for custom patch artist and labels to the boxplots
  • Loading branch information
phobson committed Dec 3, 2013
commit 04937b53259303dbcfa777ac0a450f11f30fefec
48 changes: 40 additions & 8 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2934,9 +2934,33 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True,
# lists of artists to be output
whiskers, caps, boxes, medians, means, fliers = [], [], [], [], [], []

# empty list of xticklabels
datalabels = []

# translates between line2D and patch linestyles
linestyle_map = {
'solid': '-',
'dashed': '--',
'dashdot': '-.',
'dotted': ':'
}

# plotting properties
if boxprops is None:
boxprops = dict(linestyle='-', color='black')
if patch_artist:
boxprops = dict(linestyle='solid', edgecolor='black',
facecolor='white')
else:
boxprops = dict(linestyle='-', color='black')

if patch_artist:
otherprops = dict(
linestyle=linestyle_map[boxprops['linestyle']],
color=boxprops['edgecolor']
)
else:
otherprops = dict(linestyle=boxprops['linestyle'],
color=boxprops['color'])

if flierprops is None:
flierprops = dict(linestyle='none', marker='+',
Expand Down Expand Up @@ -3011,6 +3035,9 @@ def dopatch(xs, ys, **kwargs):
holdStatus = self._hold

for pos, width, stats in zip(positions, widths, bxpstats):
# try to find a new label
datalabels.append(stats.get('label', pos))

# outliers coords
flier_x = np.ones(len(stats['outliers'])) * pos
flier_y = stats['outliers']
Expand Down Expand Up @@ -3062,19 +3089,19 @@ def dopatch(xs, ys, **kwargs):

# draw the whiskers
whiskers.extend(doplot(
whisker_x, whiskerlo_y, **boxprops
whisker_x, whiskerlo_y, **otherprops
))
whiskers.extend(doplot(
whisker_x, whiskerhi_y, **boxprops
whisker_x, whiskerhi_y, **otherprops
))

# maybe draw the caps:
if showcaps:
caps.extend(doplot(
cap_x, cap_lo, **boxprops
cap_x, cap_lo, **otherprops
))
caps.extend(doplot(
cap_x, cap_hi, **boxprops
cap_x, cap_hi, **otherprops
))

# draw the medians
Expand Down Expand Up @@ -3102,19 +3129,24 @@ def dopatch(xs, ys, **kwargs):

# fix our axes/ticks up a little
if vert:
setticks, setlim = self.set_xticks, self.set_xlim
setticks = self.set_xticks
setlim = self.set_xlim
setlabels = self.set_xticklabels
else:
setticks, setlim = self.set_yticks, self.set_ylim
setticks = self.set_yticks
setlim = self.set_ylim
setlabels = self.set_yticklabels

newlimits = min(positions) - 0.5, max(positions) + 0.5
setlim(newlimits)
setticks(positions)
setlabels(datalabels)

# reset hold status
self.hold(holdStatus)

return dict(whiskers=whiskers, caps=caps, boxes=boxes,
medians=medians, fliers=fliers)
medians=medians, fliers=fliers, means=means)

@docstring.dedent_interpd
def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None,
Expand Down