Hi folks,
I'm trying to generate a single legend for a matrix of subplots. The larger script uses the "tabular" module. I was not able to do a legend that fit correctly, so I'm creating one in another figure. I'm plotting again, but the point is just to create labels and line styles. I'm sure there is a better way. I look up line style information from a "tabular" table. Here is the problem: each row is read once and those that matche the "if" statement are plotted once--but somehow generate TWO LABELS in the legend. How is that possible?! I've attached a code snippet below. I apologize for any sloppy coding--I'm new to python. thank you, -david figure(2) subplot(111) for row in range(len(naics_styles)): if len(str(naics_styles[row]['Code'])) == 4: llabel=str(naics_styles[row]['Code'])+' '+naics_styles[row]['Name'] lred=naics_styles[row]['Red'] lgreen=naics_styles[row]['Green'] lblue=naics_styles[row]['Blue'] lalpha=naics_styles[row]['Alpha'] ltype=naics_styles[row]['LineType'] lwidth=naics_styles[row]['LineWidth'] plot([(1,8)],ltype,color=(lred,lgreen,lblue), linewidth=lwidth*2, alpha=lalpha*.75,label=llabel) legend() show() close() ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users