hinton_real

forest.benchmarking.plotting.hinton_real(matrix: numpy.ndarray, max_weight: float = None, xlabels: List[str] = None, ylabels: List[str] = None, title: str = None, ax=None, cmap=None, label_top: bool = True)

Draw Hinton diagram for visualizing a real valued weight matrix.

In the traditional Hinton diagram positive and negative values are represented by white and black squares respectively. The size of each square represents the magnitude of each value. The traditional Hinton diagram can be recovered by setting cmap = cm.Greys_r.

Parameters:
  • matrix – The matrix to be visualized.
  • max_weight – normalize size to this scalar.
  • xlabels – The labels for the operator basis.
  • ylabels – The labels for the operator basis.
  • title – The title for the plot.
  • ax – The matplotlib axes.
  • cmap – A matplotlib colormap to use when plotting.
  • label_top – If True, x-axis labels will be placed on top, otherwise they will appear below the plot.
Returns:

A tuple of the matplotlib figure and axes instances used to produce the figure.