Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 45945d1

Browse files
committed
mep28 code none
1 parent d32b290 commit 45945d1

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

doc/devel/MEP/MEP28.rst

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -264,38 +264,38 @@ value of ``statfxn`` would be ``cbook.boxplot_stats``, but users could
264264
pass their own function. Then ``transform_in`` and ``transform_out`` would
265265
then be passed as elements of the ``statfxn_args`` parameter.
266266

267-
.. code:: python
268-
269-
def boxplot_stats(data, *args, transform_in=None, transform_out=None):
270-
if transform_in is None:
271-
transform_in = lambda x: x
272-
273-
if transform_out is None:
274-
transform_out = lambda x: x
275-
276-
output = []
277-
for _d in data:
278-
d = transform_in(_d)
279-
stat_dict = do_stats(d)
280-
for key, value in stat_dict.item():
281-
if key != 'label':
282-
stat_dict[key] = transform_out(value)
283-
output.append(d)
284-
return output
285-
286-
287-
class Axes(Artist):
288-
def boxplot_option1(data, *args, transform_in=None, transform_out=None):
289-
stats = cbook.boxplot_stats(data, *args,
290-
transform_in=transform_in,
291-
transform_out=transform_out)
292-
return self.bxp(stats, *args)
293-
294-
def boxplot_option2(data, *args, statfxn=None, **statopts):
295-
if statfxn is None:
296-
statfxn = boxplot_stats
297-
stats = statfxn(data, **statopts)
298-
return self.bxp(stats, *args)
267+
.. code:: none
268+
269+
def boxplot_stats(data, ..., transform_in=None, transform_out=None):
270+
if transform_in is None:
271+
transform_in = lambda x: x
272+
273+
if transform_out is None:
274+
transform_out = lambda x: x
275+
276+
output = []
277+
for _d in data:
278+
d = transform_in(_d)
279+
stat_dict = do_stats(d)
280+
for key, value in stat_dict.item():
281+
if key != 'label':
282+
stat_dict[key] = transform_out(value)
283+
output.append(d)
284+
return output
285+
286+
287+
class Axes(...):
288+
def boxplot_option1(data, ..., transform_in=None, transform_out=None):
289+
stats = cbook.boxplot_stats(data, ...,
290+
transform_in=transform_in,
291+
transform_out=transform_out)
292+
return self.bxp(stats, ...)
293+
294+
def boxplot_option2(data, ..., statfxn=None, **statopts):
295+
if statfxn is None:
296+
statfxn = boxplot_stats
297+
stats = statfxn(data, **statopts)
298+
return self.bxp(stats, ...)
299299
300300
Both cases would allow users to do the following:
301301

0 commit comments

Comments
 (0)