code: def arrows_transitions(ax, X, indices, weight=None):
      
      step = 1
      width = axis_to_data(ax, 0.001)
      if X.shape[0] > 300:
          step = 5
          width = axis_to_data(ax, 0.0005)
      if X.shape[0] > 500:
          step = 30
          width = axis_to_data(ax, 0.0001)
      head_width = 10*width
      for ix, x in enumerate(X):
          if ix % step == 0:
              X_step = X[indices[ix]] - x
              # don't plot arrow of length 0
              for itrans in range(X_step.shape[0]):
                  alphai = 1
                  widthi = width
                  head_widthi = head_width
                  if weight is not None:
                      alphai *= weight[ix, itrans]
                      widthi *= weight[ix, itrans]
                  if np.any(X_step[itrans, :1]):
                      ax.arrow(x[0], x[1],
                               X_step[itrans, 0], X_step[itrans, 1],
                               length_includes_head=True,
                               width=widthi,
                               head_width=head_widthi,
                               alpha=alphai,
                               color='grey')
docs: Plot arrows of transitions in data matrix.
  
      Parameters
      ----------
      ax : matplotlib.axis
          Axis object from matplotlib.
      X : np.array
          Data array, any representation wished (X, psi, phi, etc).
      indices : array_like
          Indices storing the transitions.