plotting once, but two labels in legend?

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()

Please post a simple, but complete code that reproduces your problem.

-JJ

···

On Wed, Apr 28, 2010 at 3:48 AM, David Epstein <davideps@...243...> wrote:

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.