@@ -264,38 +264,38 @@ value of ``statfxn`` would be ``cbook.boxplot_stats``, but users could
264
264
pass their own function. Then ``transform_in `` and ``transform_out `` would
265
265
then be passed as elements of the ``statfxn_args `` parameter.
266
266
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, ... )
299
299
300
300
Both cases would allow users to do the following:
301
301
0 commit comments