def plot_box(df, x, y, hue, tag='eda', directory=None):
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 : str
Variable name to be used as hue, i.e., another data dimension.
tag : str
Unique identifier for the plot.
directory : str, optional
The full specification of the plot location.
Returns
-------
None : None.
References
----------
http://seaborn.pydata.org/generated/seaborn.boxplot.html
"""
logger.info("Generating Box Plot")
# Generate the box plot
box_plot = sns.boxplot(x=x, y=y, hue=hue, data=df)
sns.despine(offset=10, trim=True)
box_fig = box_plot.get_figure()
# Save the plot
write_plot('seaborn', box_fig, 'box_plot', tag, directory)
#
# Function plot_swarm
#
评论列表
文章目录