biostats.ultimate_plot#

biostats.ultimate_plot(data, variable)[source]#

Draw a multiple plot to show the relations between every two variables.

Parameters:
datapandas.DataFrame

The input data. Must contain at least one column.

variablelist

The list of variables to be plotted.

Returns:
figmatplotlib.figure.Figure

The generated plot.

See also

pair_plot

Draw a multiple plot to show the relations between every two numeric variables.

joint_plot

Draw a combined plot to show the relation between two numeric variables.

Notes

The kinds of plots that will be generated in each grid:

Variable 1

Variable 2

Plot

numeric

histogram

categorical

count plot

numeric

numeric

scatter plot

numeric

categorical

strip plot

categorical

categorical

count plot (colored)

Examples

>>> import biostats as bs
>>> import matplotlib.pyplot as plt
>>> data = bs.dataset("penguins.csv")
>>> data
    species     island  bill_length_mm  bill_depth_mm  flipper_length_mm  body_mass_g     sex
0    Adelie  Torgersen            39.1           18.7                181         3750    MALE
1    Adelie  Torgersen            39.5           17.4                186         3800  FEMALE
2    Adelie  Torgersen            40.3           18.0                195         3250  FEMALE
3    Adelie  Torgersen             NaN            NaN               <NA>         <NA>     NaN
4    Adelie  Torgersen            36.7           19.3                193         3450  FEMALE
..      ...        ...             ...            ...                ...          ...     ...
339  Gentoo     Biscoe             NaN            NaN               <NA>         <NA>     NaN
340  Gentoo     Biscoe            46.8           14.3                215         4850  FEMALE
341  Gentoo     Biscoe            50.4           15.7                222         5750    MALE
342  Gentoo     Biscoe            45.2           14.8                212         5200  FEMALE
343  Gentoo     Biscoe            49.9           16.1                213         5400    MALE

We want to visualize the relations between these variables.

>>> fig = bs.ultimate_plot(data=data, variable=["species", "bill_length_mm", "body_mass_g", "sex"])
>>> plt.show()
../../_images/biostats-ultimate_plot-1.png