def add_lines(self, levels, colors, linewidths):
N = len(levels)<EOL>dummy, y = self._locate(levels)<EOL>if len(y) != N:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>x = np.array([<NUM_LIT:0.0>, <NUM_LIT:1.0>])<EOL>X, Y = np.meshgrid(x,y)<EOL>if self.orientation == '<STR_LIT>':<EOL><INDENT>xy = [list(zip(X[i], Y[i])) for i in range(N)]<EOL><DEDENT>else:<EOL><INDENT>xy = [list(zip(Y[i], X[i])) for i in range(N)]<EOL><DEDENT>col = collections.LineCollection(xy, linewidths=linewidths)<EOL>self.lines = col<EOL>col.set_color(colors)<EOL>self.ax.add_collection(col)<EOL>
Draw lines on the colorbar.