docs: def draw_state(ax, p, text='', l=0.5, alignment='left', label_displacement=1.0,
                 fontsize=25, atoms=None, atoms_h=0.125, atoms_size=5, **kwds):
      r"""Draw a quantum state for energy level diagrams."""
      ax.plot([p[0]-l/2.0, p[0]+l/2.0], [p[1], p[1]],
              color='black', **kwds)
      if text != '':
          if alignment == 'left':
              ax.text(p[0] - l/2.0 - label_displacement, p[1], text,
                      horizontalalignment='right', verticalalignment='center',
                      color='black', fontsize=fontsize)
          elif alignment == 'right':
              ax.text(p[0] + l/2.0 + label_displacement, p[1], text,
                      horizontalalignment='left', color='black',
                      fontsize=fontsize)
  
      # We draw atoms.
      if atoms is not None:
          atoms_x = np.linspace(p[0]-l*0.5, p[0]+l*0.5, atoms)
          atoms_y = [p[1] + atoms_h for i in range(atoms)]
          # print l, atoms_x
          ax.plot(atoms_x, atoms_y, "ko", ms=atoms_size)