BPt.Dataset.plots#
- Dataset.plots(scope, subjects='all', ncols=3, figsize='default', cut=0, decode_values=True, count=True, show=True, reduce_func=<function mean>, n_jobs=-1)[source]#
This function creates a multi-figure plot containing all of the passed columns (as specified by scope) in their own axes.
- Parameters
- scopeScope
A BPt style Scope used to select a subset of column(s) in which to apply the current function to. See Scope for more information on how this can be applied.
- subjectsSubjects
This argument can be any of the BPt accepted subject style inputs. E.g., None, ‘nan’ for subjects with any nan data, or ‘not not’ for subjects without any, the str location of a file formatted with one subject per line, or directly as an array-like of subjects, to list a few options.
See Subjects for all options, and a more detailed description of the already mentioned options.
- ncolsint, optional
Number of columns to plot by.
default = 3
- figsize‘default’ or tuple, optional
The size of the subplot to initialize.
Default will try to scale to number of rows and cols
default = 'default'
- decode_valuesbool, optional
When handling categorical variables that have been encoded through a BPt dataset method, e.g.,
Dataset.ordinalize()
, then you may optionally either use either the original categorical values before encoding with decode_values = True, or use the current internal values with decode_values = False.default = True
- cutfloat, optional
Only for plotting non-categorical variables. Factor, multiplied by the smoothing bandwidth, that determines how far the evaluation grid extends past the extreme datapoints. When set to 0, truncate the curve at the data limits.
default = 0
- countbool, optional
Only for plotting categorical variables. If True, then display the counts, if False, then display the frequency out of 1.
default = True
- showbool, optional
If plt.show() from matplotlib should be called after plotting each column within the passed scope. You will typically want this parameter to be the default True, as when plotting multiple columns, they might otherwise overlap.
If False, return (fig, axes), otherwise if True, return None.
default = True
- reduce_funcpython function, optional
The passed python function will be applied only if the requested col/column is a ‘data file’. In the case that it is, the function should accept as input the data from one data file, and should return a single scalar value. For example, the default value is numpy’s mean function, which returns one value.
default = np.mean
- n_jobsint, optional
As with reduce_func, this parameter is only valid when the passed col/column is a ‘data file’. In that case, this specifies the number of cores to use in loading and applying the reduce_func to each data file. This can provide a significant speed up when passed the number of available cores, but can sometimes be memory intensive depending on the underlying size of the file.
If set to -1, will try to automatically use all available cores.
default = -1
- Returns
- fig, axesFigure and Axes or None
If show is True, None is returned, otherwise the subplot figure + its Axes are returned.
Examples
This example shows plotting a simple collage over three fake features.
data = bp.Dataset([[1, 2, 3], [2, 2, 2], [3, 3, 3]], columns=['f1', 'f2', 'f3']) data.plots(scope='all')