docs: def _hexplot(matrix, fig, colormap):
      """Internal function to plot a hexagonal map.
      """
      umatrix_min = matrix.min()
      umatrix_max = matrix.max()
      n_rows, n_columns = matrix.shape
      cmap = plt.get_cmap(colormap)
      offsets = np.zeros((n_columns * n_rows, 2))
      facecolors = []
      for row in range(n_rows):
          for col in range(n_columns):
              if row % 2 == 0:
                  offsets[row * n_columns + col] = [col +
                                                    0.5, 2 * n_rows - 2 * row]
                  facecolors.append(cmap((matrix[row, col] - umatrix_min) /
                                         (umatrix_max) * 255))
              else:
                  offsets[row * n_columns + col] = [col, 2 * n_rows - 2 * row]
                  facecolors.append(cmap((matrix[row, col] - umatrix_min) /
                                         (umatrix_max) * 255))
      polygon = np.zeros((6, 2), float)
      polygon[:, 0] = 1.1 * np.array([0.5, 0.5, 0.0, -0.5, -0.5, 0.0])
      polygon[:, 1] = 1.1 * np.array([-np.sqrt(3) / 6, np.sqrt(3) / 6,
                                      np.sqrt(3) / 2 + np.sqrt(3) / 6,
                                      np.sqrt(3) / 6, -np.sqrt(3) / 6,
                                      -np.sqrt(3) / 2 - np.sqrt(3) / 6])
      polygons = np.expand_dims(polygon, 0) + np.expand_dims(offsets, 1)
      ax = fig.gca()
      collection = mcoll.PolyCollection(
          polygons,
          offsets=offsets,
          facecolors=facecolors,
          edgecolors=facecolors,
          linewidths=1.0,
          offset_position="data")
      ax.add_collection(collection, autolim=False)
      corners = ((-0.5, -0.5), (n_columns + 0.5, 2 * n_rows + 0.5))
      ax.update_datalim(corners)
      ax.autoscale_view(tight=True)
      return offsets