dsci_524_ezplot.plot_scatterplot ================================ .. py:module:: dsci_524_ezplot.plot_scatterplot Functions --------- .. autoapisummary:: dsci_524_ezplot.plot_scatterplot.plot_scatterplot Module Contents --------------- .. py:function:: plot_scatterplot(df, x, y, color=None, title=None, xlabel=None, ylabel=None) Create a scatter plot from the provided dataset or Array. :param df: The dataset containing the variables to plot. Must be a pandas DataFrame or a NumPy array. :type df: pandas.DataFrame or numpy.ndarray :param x: The name of the column to use for the x-axis values. :type x: str :param y: The name of the column to use for the y-axis values. :type y: str :param color: The name of the column to use for color-coding the points. If the column is categorical, colors will be mapped to unique categories (default is None). :type color: str, optional :param title: The title of the scatter plot (default is None). :type title: str, optional :param xlabel: The label for the x-axis (default is None). :type xlabel: str, optional :param ylabel: The label for the y-axis (default is None). :type ylabel: str, optional :returns: A Matplotlib figure and axes object containing the scatter plot. :rtype: matplotlib.figure.Figure, matplotlib.axes.Axes :raises TypeError: If the input data is not a pandas DataFrame or NumPy array. If the `x` or `y` column contains non-numeric or mixed data types. :raises ValueError: If the DataFrame or NumPy array is empty. .. rubric:: Example >>> import pandas as pd >>> df = pd.DataFrame({ ... 'height': [150, 160, 165, 170], ... 'weight': [50, 60, 65, 70], ... 'category': ['small', 'medium', 'medium', 'large'] ... }) >>> fig, ax = plot_scatterplot(df, x='height', y='weight', color='category', ... title='Height vs. Weight', ... xlabel='Height (cm)', ylabel='Weight (kg)')