docs: def _view_matrix(self, matrix, figsize, colormap, colorbar, bestmatches,
                       bestmatchcolors, labels, zoom, filename):
          """Internal function to plot a map with best matching units and labels.
          """
          if zoom is None:
              zoom = ((0, self._n_rows), (0, self._n_columns))
          if figsize is None:
              figsize = (8, 8 / float(zoom[1][1] / zoom[0][1]))
          fig = plt.figure(figsize=figsize)
          if self._grid_type == "hexagonal":
              offsets = _hexplot(matrix[zoom[0][0]:zoom[0][1],
                                        zoom[1][0]:zoom[1][1]], fig, colormap)
              filtered_bmus = self._filter_array(self.bmus, zoom)
              filtered_bmus[:, 0] = filtered_bmus[:, 0] - zoom[1][0]
              filtered_bmus[:, 1] = filtered_bmus[:, 1] - zoom[0][0]
              bmu_coords = np.zeros(filtered_bmus.shape)
              for i, (row, col) in enumerate(filtered_bmus):
                  bmu_coords[i] = offsets[col * zoom[1][1] + row]
          else:
              plt.imshow(matrix[zoom[0][0]:zoom[0][1], zoom[1][0]:zoom[1][1]],
                         aspect='auto', interpolation='bicubic')
              plt.set_cmap(colormap)
              bmu_coords = self._filter_array(self.bmus, zoom)
              bmu_coords[:, 0] = bmu_coords[:, 0] - zoom[1][0]
              bmu_coords[:, 1] = bmu_coords[:, 1] - zoom[0][0]
          if colorbar:
              cmap = cm.ScalarMappable(cmap=colormap)
              cmap.set_array(matrix)
              plt.colorbar(cmap, orientation='horizontal', shrink=0.5)
  
          if bestmatches:
              if bestmatchcolors is None:
                  if self.clusters is None:
                      colors = "white"
                  else:
                      colors = []
                      for bm in self.bmus:
                          colors.append(self.clusters[bm[1], bm[0]])
                      colors = self._filter_array(colors, zoom)
              else:
                  colors = self._filter_array(bestmatchcolors, zoom)
              plt.scatter(bmu_coords[:, 0], bmu_coords[:, 1], c=colors)
  
          if labels is not None:
              for label, col, row in zip(self._filter_array(labels, zoom),
                                         bmu_coords[:, 0], bmu_coords[:, 1]):
                  if label is not None:
                      plt.annotate(label, xy=(col, row), xytext=(10, -5),
                                   textcoords='offset points', ha='left',
                                   va='bottom',
                                   bbox=dict(boxstyle='round,pad=0.3',
                                             fc='white', alpha=0.8))
          plt.axis('off')
          if filename is not None:
              plt.savefig(filename)
          else:
              plt.show()
          return plt