From: Sterling Smith <smithsp@fu...>  20111027 17:05:27

Adam, Your example is not complete. I don't understand the value variable that you are iterating over, or how it affects the different plots you are making. I would guess that the problem is that you have a list of tuples of handles for value_plot, instead of a list of handles. Note that each of the plot_date commands returns a length=1 tuple of lines. So you should pick out the first item of each tuple, and you probably only need the 1st item of the value_plot list, since you only give 3 labels. Sterling PS Sorry if somebody already responded; I get my list mail in digests. > > > From: Adam Mercer <ramercer@...> > Date: October 27, 2011 6:12:50 AM PDT > To: matplotlibusers@... > Subject: [Matplotlibusers] Legend and proxy artists > > > Hi > > I have recently updated to Matplotlib1.1.0 and now one of my scripts > displays the following warning: > > UserWarning: Legend does not support [[<matplotlib.lines.Line2D object > at 0x1026296d0>]] > Use proxy artist instead. > > http://matplotlib.sourceforge.net/users/legend_guide.html#usingproxyartist > > The link it refers to doesn't seem to be much help, and I can't see > what I need to do in order to correctly display the legend. Below is > the appropriate plotting section of my script, could anyone offer > suggestions as to how to correctly display the legend? > > # plot size, scale by golden ratio > fig = pyplot.figure() > fig.set_size_inches(10, 10 / ((1 + math.sqrt(5)) / 2)) > date_axes = fig.add_subplot(111) > > # setup secondary axes > value_axes = date_axes.twinx() > > # set plot labels > date_axes.set_xlabel("Date") > date_axes.set_ylabel("Time") > value_axes.set_ylabel("Value") > > # produce plot > morning_plot = date_axes.plot_date(morning[:,0], morning[:,1], 'bo', ms=4) > evening_plot = date_axes.plot_date(evening[:,0], evening[:,1], 'go', ms=4) > value_plot = [] > for v in value: > value_plot.append(value_axes.plot_date(w[:,0], w[:,1], 'ro', ms=4)) > > # legend > date_axes.legend(([morning_plot], [evening_plot], [value_plot]), > ("Morning", "Evening", "Value"), > numpoints=1, loc=0, borderpad=1, shadow=True, fancybox=True) > > # save plot > fig.savefig(plot_file) > > Cheers > > Adam > 