Hi

I have recently updated to Matplotlib-1.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#using-proxy-artist

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

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to