code: def _rgbline(ax, k, e, red, green, blue, alpha=1, linestyles="solid"):
          
          from matplotlib.collections import LineCollection
  
          pts = np.array([k, e]).T.reshape(-1, 1, 2)
          seg = np.concatenate([pts[:-1], pts[1:]], axis=1)
  
          nseg = len(k) - 1
          r = [0.5 * (red[i] + red[i + 1]) for i in range(nseg)]
          g = [0.5 * (green[i] + green[i + 1]) for i in range(nseg)]
          b = [0.5 * (blue[i] + blue[i + 1]) for i in range(nseg)]
          a = np.ones(nseg, np.float) * alpha
          lc = LineCollection(seg, colors=list(zip(r, g, b, a)),
                              linewidth=2, linestyles=linestyles)
          ax.add_collection(lc)
docs: An RGB colored line for plotting.
          creation of segments based on:
          http://nbviewer.ipython.org/urls/raw.github.com/dpsanders/matplotlib-examples/master/colorline.ipynb
          Args:
              ax: matplotlib axis
              k: x-axis data (k-points)
              e: y-axis data (energies)
              red: red data
              green: green data
              blue: blue data
              alpha: alpha values data
              linestyles: linestyle for plot (e.g., "solid" or "dotted")