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

Function plot_scatter

alphapy/plots.py:935–975  ·  view source on GitHub ↗

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.

(df, features, target, tag='eda', directory=None)

Source from the content-addressed store, hash-verified

933#
934
935def plot_scatter(df, features, target, tag='eda', directory=None):
936 r"""Plot a scatterplot matrix, also known as a pair plot.
937
938 Parameters
939 ----------
940 df : pandas.DataFrame
941 The dataframe containing the features.
942 features: list of str
943 The features to compare in the scatterplot.
944 target : str
945 The target variable for contrast.
946 tag : str
947 Unique identifier for the plot.
948 directory : str, optional
949 The full specification of the plot location.
950
951 Returns
952 -------
953 None : None.
954
955 References
956 ----------
957
958 https://seaborn.pydata.org/examples/scatterplot_matrix.html
959
960 """
961
962 logger.info("Generating Scatter Plot")
963
964 # Get the feature subset
965
966 features.append(target)
967 df = df[features]
968
969 # Generate the pair plot
970
971 sns.set()
972 sns_plot = sns.pairplot(df, hue=target)
973
974 # Save the plot
975 write_plot('seaborn', sns_plot, 'scatter_plot', tag, directory)
976
977
978#

Callers

nothing calls this directly

Calls 1

write_plotFunction · 0.85

Tested by

no test coverage detected