Line Plot
- class MatPlus.LinePlot.LinePlot(x, y, lowerlimx=None, lowerlimy=None, upperlimx=None, upperlimy=None, lw=None, width=3, height=3)[source]
A class for creating line plots using matplotlib.
The LinePlot class provides a simplified interface for creating line plots with customizable axis limits and line properties. It supports plotting multiple lines on the same figure.
- Parameters:
x (list or list of lists) – The x-coordinates of the line(s). For multiple lines, provide a list of lists.
y (list or list of lists) – The y-coordinates of the line(s). For multiple lines, provide a list of lists.
lowerlimx (float, optional) – Lower limit of the x-axis. Default is None (auto-determined).
lowerlimy (float, optional) – Lower limit of the y-axis. Default is None (auto-determined).
upperlimx (float, optional) – Upper limit of the x-axis. Default is None (auto-determined).
upperlimy (float, optional) – Upper limit of the y-axis. Default is None (auto-determined).
lw (float, optional) – Line width for the plot. Default is None (uses matplotlib default).
width (float, optional) – The width of the plot in inches. Default is 3.
height (float, optional) – The height of the plot in inche. Default is 3.
Examples
>>> # Single line plot >>> x = [1, 2, 3, 4, 5] >>> y = [1, 4, 9, 16, 25] >>> line_plot = LinePlot(x, y) >>> line_plot.plot()
>>> # Multiple line plot >>> x = [[1, 2, 3], [1, 2, 3, 4]] >>> y = [[1, 2, 3], [4, 3, 2, 1]] >>> line_plot = LinePlot(x, y, lowerlimx=0, upperlimx=5) >>> line_plot.plot()