dsci_524_ezplot.plot_line ========================= .. py:module:: dsci_524_ezplot.plot_line Functions --------- .. autoapisummary:: dsci_524_ezplot.plot_line.plot_line Module Contents --------------- .. py:function:: plot_line(df, x, y, title=None, xlabel=None, ylabel=None, x_decimals=None, y_decimals=None) Create a line plot using data from a pandas DataFrame. :param df: Input DataFrame containing the data to plot :type df: pandas.DataFrame :param x: Column name for x-axis values :type x: str :param y: Column name for y-axis values :type y: str :param title: Title of the plot (default: None) :type title: str, optional :param xlabel: Label for x-axis (default: x column name) :type xlabel: str, optional :param ylabel: Label for y-axis (default: y column name) :type ylabel: str, optional :param x_decimals: Number of decimal places for x-axis values (default: None) :type x_decimals: int, optional :param y_decimals: Number of decimal places for y-axis values (default: None) :type y_decimals: int, optional :returns: - matplotlib.figure.Figure The figure object containing the plot - matplotlib.axes.Axes The axes object containing the plot elements :rtype: tuple .. rubric:: Examples >>> import pandas as pd >>> df = pd.DataFrame({'year': [2020, 2021, 2022], 'sales': [100, 150, 200]}) >>> fig, ax = plot_line(df, 'year', 'sales', 'Annual Sales', 'Year', 'Sales', ... x_decimals=0, y_decimals=2)