Is it possible to include a marker from one or more
> scatter plots in the legend? Robert
This is a bit tricky -- scatter plots can vary in size and color.
What should one use for the legend marker? So the short answer is no.
My question for you is, "how *should* it work?"
Not if you are using homogeneous marker sizes and colors, I suggest
using plot markers tweaking the properties, as in
line, = plot(x,y,linestyle='None', marker='s',
or the pithy
line, = plot(x, y, ls='None', marker='s',
mfc='red', mec='g', ms=20, mew=3)
These you can add to the legend.
In matplotlib-0.72, this will be as fast or faster than scatter for
the agg backend. Probably faster.
If this is not an option -- eg you need variation in size but not
color, you can use a line as a stand-in in your legend. Create the
line, don't add it to the axes, but pass it to the legend
sizes = 20*rand(len(x))
scatter(x,y,s=sizes, marker='o', c='red')
# now create the proxy line but don't add it to axes for drawing
line = Line2D(x,y,marker='o', color='red')
This is untested, so let me know how it goes...