plot_class_map

mcalf.visualisation.plot_class_map(class_map, overall_classes=None, classes=None, time_index=None, cadence=None, xticks=0, 15, 2, yticks=0, 15, 2, xscale=0.070325, yscale=0.070325, output=None, file_prefix='classmap_plot_', file_ext='png', figsize=6.0, 3.6, dpi=600, fontfamily=None, cache=False)[source]

Plot an image of the classifications at a particular time along with bar charts of the classifications

Parameters
  • class_map (ndarray, ndim=2 or 3) – Two-dimensional array of classifications. If three dimensions are given, the first dimension is assumed to represent the time.

  • overall_classes (ndarray or bool, optional) – The percentage of spectra that belong to each classification in the overall dataset. If omitted, these will be calculated used all of the classifications given is class_map. If true is given, these will also be calculated in the same way and returned without any plotting done. (This returned array can then be used to speed up later calls of this function.)

  • classes (ndarray, optional, default = ndarray of [0, 1, 2, 3, 4]) – Array of all the possible classifications in class_map.

  • time_index (int, optional, default = 0) – The index of the time dimension of class_map, required if class_map is 3D. Also used for plotting the time.

  • cadence (float, units = seconds, optional, default = None) – If given, the time index will be multiplied by this value and converted into a time in minutes on the plot. Otherwise, the time_index will be plotted without units.

  • xticks (3-tuple, optional, default = (0, 15, 2)) – The start, stop and step for the x-axis ticks in Mm.

  • yticks (3-tuple, optional, default = (0, 15, 2)) – The start, stop and step for the y-axis ticks in Mm.

  • xscale (float, optional = 0.725 * 0.097) – Scaling factor between x-axis data coordinate steps and 1 Mm. Mm = data / xscale.

  • yscale (float, optional = 0.725 * 0.097) – Scaling factor between y-axis data coordinate steps and 1 Mm. Mm = data / xscale.

  • output (str or bool, optional, default = None) – If present, the filename to save the plot as. If omitted, the plot will not be saved. If true, the filename will be generated using the time_index along with the file_prefix and file_ext.

  • file_prefix (str, optional, default = ‘classmap_plot_’) – The prefix to use in the filename when output is true.

  • file_ext (str, optional, default = 'png') – The file extension (without the dot) to use when output is true.

  • figsize (2-tuple, optional, default = None) – Size of the figure.

  • dpi (int, optional, default = 600) – The number of dots per inch. For controlling the quality of the outputted figure.

  • fontfamily (str, optional, default = None) – If provided, this family string will be added to the ‘font’ rc params group.

  • cache (bool, optional, default = False) – If true, the plot will not be regenerated if the output filename already exists.

Returns

overall_classes – If overall_classes is initially true, their calculated values will be returned.

Return type

ndarray