scatter_2d

ssapy.plotUtils.scatter_2d(x, y, cs, xlabel='x', ylabel='y', title='', cbar_label='', dotsize=1, colorsMap='jet', colorscale='linear', colormin=False, colormax=False, save_path=False)[source][source]

Create a 2D scatter plot with optional color mapping.

Parameters: - x (numpy.ndarray): Array of x-coordinates. - y (numpy.ndarray): Array of y-coordinates. - cs (numpy.ndarray): Array of values for color mapping. - xlabel (str, optional): Label for the x-axis. Default is ‘x’. - ylabel (str, optional): Label for the y-axis. Default is ‘y’. - title (str, optional): Title of the plot. Default is an empty string. - cbar_label (str, optional): Label for the color bar. Default is an empty string. - dotsize (int, optional): Size of the dots in the scatter plot. Default is 1. - colorsMap (str, optional): Colormap to use for the color mapping. Default is ‘jet’. - colorscale (str, optional): Scale for the color mapping, either ‘linear’ or ‘log’. Default is ‘linear’. - colormin (float, optional): Minimum value for color scaling. If False, it is set to the minimum value of cs. Default is False. - colormax (float, optional): Maximum value for color scaling. If False, it is set to the maximum value of cs. Default is False. - save_path (str, optional): File path to save the plot. If not provided, the plot is not saved. Default is False.

Returns: - fig (matplotlib.figure.Figure): The figure object. - ax (matplotlib.axes._subplots.AxesSubplot): The 2D axis object.

This function creates a 2D scatter plot with optional color mapping based on the values provided in cs. The color mapping can be adjusted using either a linear or logarithmic scale. The plot can be customized with axis labels, title, and colormap. The plot can also be saved to a specified file path.

Example usage: ``` import numpy as np from your_module import scatter_2d

# Example data x = np.random.rand(100) y = np.random.rand(100) cs = np.random.rand(100)

scatter_2d(x, y, cs, xlabel=’X-axis’, ylabel=’Y-axis’, cbar_label=’Color Scale’, title=’2D Scatter Plot’) ```