def plot_scatter(df, features, target, tag='eda', directory=None):
r"""Plot a scatterplot matrix, also known as a pair plot.
Parameters
----------
df : pandas.DataFrame
The dataframe containing the features.
features: list of str
The features to compare in the scatterplot.
target : str
The target variable for contrast.
tag : str
Unique identifier for the plot.
directory : str, optional
The full specification of the plot location.
Returns
-------
None : None.
References
----------
https://seaborn.pydata.org/examples/scatterplot_matrix.html
"""
logger.info("Generating Scatter Plot")
# Get the feature subset
features.append(target)
df = df[features]
# Generate the pair plot
sns.set()
sns_plot = sns.pairplot(df, hue=target)
# Save the plot
write_plot('seaborn', sns_plot, 'scatter_plot', tag, directory)
#
# Function plot_facet_grid
#
评论列表
文章目录