uf3.util.plotting.density_scatter

density_scatter(references, predictions, ax=None, loglog=False, lims=None, lim_factor=0.5, subset_threshold=1000, cmap=None, metrics=True, text_size=10, units=None, labels=True, label_size=10, **scatter_kwargs)[source]
Plot regression performance with a scatter plot of predictions vs.

references, colored by log-density of points. Optionally display mean-absolute error, root-mean-square error, minimum residual, and maximum residual.

Parameters
  • references (list, np.ndarray) – Vector of Y-axis values.

  • predictions (list, np.ndarray) – Vector of X-axis values.

  • ax (axes.Axes) – Optional handle for existing matplotlib axis object

  • loglog (bool) – whether to plot on a log-log scale.

  • lims (tuple) – lower and upper bounds for axis limits.

  • lim_factor (float) – tuning factor for automatically determining limits.

  • subset_threshold (int) – maximum number of points to plot. If exceeded, subset will be selected randomly.

  • cmap (matplotlib.colors.LinearSegmentedColormap) – color map.

  • metrics (bool) – plot text with metrics e.g. root-mean-square-error.

  • text_size (int) – fontsize for metrics text.

  • units (str) – units for axis labels.

  • labels (bool) – add axis labels.

  • label_size (int) – fontsize for axis and tick labels.

  • **scatter_kwargs – keyword arguments for plt.scatter function.

Returns

matplotlib figure and axis.

Return type

fig & ax