MCPcopy Create free account
hub / github.com/ScottfreeLLC/AlphaPy / plot_box

Function plot_box

alphapy/plots.py:1079–1117  ·  view source on GitHub ↗

r"""Display a Box Plot. Parameters ---------- df : pandas.DataFrame The dataframe containing the ``x`` and ``y`` features. x : str Variable name in ``df`` to display along the x-axis. y : str Variable name in ``df`` to display along the y-axis. hue :

(df, x, y, hue, tag='eda', directory=None)

Source from the content-addressed store, hash-verified

1077#
1078
1079def plot_box(df, x, y, hue, tag='eda', directory=None):
1080 r"""Display a Box Plot.
1081
1082 Parameters
1083 ----------
1084 df : pandas.DataFrame
1085 The dataframe containing the ``x`` and ``y`` features.
1086 x : str
1087 Variable name in ``df`` to display along the x-axis.
1088 y : str
1089 Variable name in ``df`` to display along the y-axis.
1090 hue : str
1091 Variable name to be used as hue, i.e., another data dimension.
1092 tag : str
1093 Unique identifier for the plot.
1094 directory : str, optional
1095 The full specification of the plot location.
1096
1097 Returns
1098 -------
1099 None : None.
1100
1101 References
1102 ----------
1103
1104 http://seaborn.pydata.org/generated/seaborn.boxplot.html
1105
1106 """
1107
1108 logger.info("Generating Box Plot")
1109
1110 # Generate the box plot
1111
1112 box_plot = sns.boxplot(x=x, y=y, hue=hue, data=df)
1113 sns.despine(offset=10, trim=True)
1114 box_fig = box_plot.get_figure()
1115
1116 # Save the plot
1117 write_plot('seaborn', box_fig, 'box_plot', tag, directory)
1118
1119
1120#

Callers

nothing calls this directly

Calls 1

write_plotFunction · 0.85

Tested by

no test coverage detected