def _normalize_histogram2d(self, counts, type):
        """Normalize the values of the counts for a 2D histogram.

        This normalizes the values of a numpy array to the range 0-255.

        :param counts: a NumPy array which is to be rescaled.
        :param type: either 'bw' or 'reverse_bw'.

        """
        counts = (255 * (counts - np.nanmin(counts)) /
                  (np.nanmax(counts) - np.nanmin(counts)))

        if type == 'reverse_bw':
            counts = 255 - counts

        return counts.astype(np.uint8)
Normalize the values of the counts for a 2D histogram.

        This normalizes the values of a numpy array to the range 0-255.

        :param counts: a NumPy array which is to be rescaled.
        :param type: either 'bw' or 'reverse_bw'.