Hello Joseph, I'm not sure I understand correctly, but it seems to me that the number of plotted lines (from errorbar, len(gca().lines) ) is large compared to your 3 labels. That's why only the lines of the first errorbar are used to build the legend. It might to helpful to use the 'label' kwarg of errorbar to properly connect the errorbar to a label. After that you can build the legend with 'legend()'.
regards Matthias PS: Could you provide a complete example, if my suggestion doesn't help, please? On Wednesday 09 April 2008 10:54:23 Joseph Xu wrote: > Hi: > > I'm having a problem where the lines I plot show up in one style (all > solid, with different colors) while the legend shows them to be a > different style (all blue, different dashes). I used the following > code to plot: > > labels = [] > dir_names = {'U' : 'UP', 'D' : 'DOWN', 'L' : 'LEFT', 'R' : 'RIGHT'} > for dir in lines: > xa = sorted(lines[dir].keys()) > ya = [lines[dir][x][0] for x in xa] > yerr = [] > for x in xa: > if lines[dir][x][1] > lines[dir][x][2]: > # no bound data > yerr.append([0,0]) > else: > yerr.append([lines[dir][x][1] - lines[dir][x][0], > lines[dir][x][2] > - lines[dir][x][0]]) > yerra = array(yerr).transpose() > errorbar(xa, ya, yerr=yerra) > labels.append(dir_names[dir]) > > legend(labels) > show() > > > Here's the result: > > http://i32.tinypic.com/2eat8r8.jpg > > What am I doing wrong? > > Thanks for the help. > > Joseph > > ------------------------------------------------------------------------- > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference > Don't miss this year's exciting event. There's still time to save $100. > Use priority code J8TL2D2. > http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/java >one _______________________________________________ > Matplotlib-users mailing list > Matplotlib-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-users ------------------------------------------------------------------------- This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users