SOMPlots

SOMPlots functions.

susi.SOMPlots.plot_estimation_map(estimation_map: ndarray, cbar_label: str = 'Variable in unit', cmap: str = 'viridis', fontsize: int = 20) Axes[source]

Plot estimation map.

Parameters:
  • estimation_map (np.ndarray) – Estimation map of the size (n_rows, n_columns)

  • cbar_label (str, optional) – Label of the colorbar, by default “Variable in unit”

  • cmap (str, optional (default=”viridis”)) – Colormap

  • fontsize (int, optional (default=20)) – Fontsize of the labels

Returns:

ax – Plot axis

Return type:

pyplot.axis

susi.SOMPlots.plot_nbh_dist_weight_matrix(som, it_frac: float = 0.1) Axes[source]

Plot neighborhood distance weight matrix in 3D.

Parameters:
  • som (susi.SOMClustering or related) – Trained (un)supervised SOM

  • it_frac (float, optional (default=0.1)) – Fraction of som.n_iter_unsupervised for the plot state.

Returns:

ax – Plot axis

Return type:

pyplot.axis

susi.SOMPlots.plot_som_histogram(bmu_list: List[Tuple[int, int]], n_rows: int, n_columns: int, n_datapoints_cbar: int = 5, fontsize: int = 22) Axes[source]

Plot 2D Histogram of SOM.

Plot 2D Histogram with one bin for each SOM node. The content of one bin is the number of datapoints matched to the specific node.

Parameters:
  • bmu_list (list of (int, int) tuples) – Position of best matching units (row, column) for each datapoint

  • n_rows (int) – Number of rows for the SOM grid

  • n_columns (int) – Number of columns for the SOM grid

  • n_datapoints_cbar (int, optional (default=5)) – Maximum number of datapoints shown on the colorbar

  • fontsize (int, optional (default=22)) – Fontsize of the labels

Returns:

ax – Plot axis

Return type:

pyplot.axis

susi.SOMPlots.plot_umatrix(u_matrix: ndarray, n_rows: int, n_colums: int, cmap: str = 'Greys', fontsize: int = 18) Axes[source]

Plot u-matrix.

Parameters:
  • u_matrix (np.ndarray) – U-matrix containing the distances between all nodes of the unsupervised SOM. Shape = (n_rows*2-1, n_columns*2-1)

  • n_rows (int) – Number of rows for the SOM grid

  • n_columns (int) – Number of columns for the SOM grid

  • cmap (str, optional (default=”Greys)) – Colormap

  • fontsize (int, optional (default=18)) – Fontsize of the labels

Returns:

ax – Plot axis

Return type:

pyplot.axis