Scatter Plot

class MatPlus.ScatterPlot.ScatterPlot(x, y, lowerlimx=None, lowerlimy=None, upperlimx=None, upperlimy=None, sizes=[], colors=[], vmin=0, vmax=0, width=1, height=1)[source]

A class for creating scatter plots with customizable properties.

The ScatterPlot class provides a simplified interface for creating scatter plots with customizable axis limits and point properties such as sizes and colors.

Parameters:
  • x (array-like) – The x-coordinates of the data points.

  • y (array-like) – The y-coordinates of the data points.

  • lowerlimx (float, optional) – Lower limit of the x-axis. Default is None (auto-determined as 90% of minimum x).

  • lowerlimy (float, optional) – Lower limit of the y-axis. Default is None (auto-determined as 90% of minimum y).

  • upperlimx (float, optional) – Upper limit of the x-axis. Default is None (auto-determined as 110% of maximum x).

  • upperlimy (float, optional) – Upper limit of the y-axis. Default is None (auto-determined as 110% of maximum y).

  • sizes (array-like, optional) – The sizes of the data points. Default is empty list (uses default size).

  • colors (array-like, optional) – The colors of the data points. Default is empty list (uses default color).

  • vmin (float, optional) – The minimum value for color scaling. Default is 0.

  • vmax (float, optional) – The maximum value for color scaling. Default is 0.

  • width (float, optional) – The width of the plot. Default is 1.

  • height (float, optional) – The height of the plot in inches. Controls the vertical size of the figure. Default is 1.

Examples

>>> # Basic scatter plot
>>> x = [1, 2, 3, 4, 5]
>>> y = [1, 4, 9, 16, 25]
>>> scatter = ScatterPlot(x, y)
>>> scatter.plot()
>>> # Scatter plot with custom point sizes
>>> scatter = ScatterPlot(x, y, sizes=[10, 20, 30, 40, 50])
>>> scatter.plot()
>>> # Scatter plot with colored points
>>> scatter = ScatterPlot(x, y, colors=[0.1, 0.5, 0.7, 0.9, 1.0], vmin=0, vmax=1)
>>> scatter.plot()
plot()[source]

Create and display the scatter plot.

This method creates a matplotlib figure and plots the data points provided during initialization with the specified properties. It applies all configured settings such as point sizes, colors, and axis limits before displaying the plot.

Returns:

The plot is displayed but not returned.

Return type:

None