Hi,
I am adding several scatter plots to the same axis, each having a specific
color. When I call legend on the axis it correctly picks all scatter plots with
their symbols and labels, but it doesn't pick up the color. The example below
demonstrates this. What I would like to do is to have in the legend the marker
its color matching that of the set it represents. How would I do this? 

Thanks,

Jorge

PS: I am using matplotlib 1.0

-----------
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt

data0 = np.random.rand(10,2)
data1 = np.random.rand(10,2)
data2 = np.random.rand(10,2)
data = [data0, data1, data2]

fig, ax = plt.subplots(1,1)
norm = mpl.colors.Normalize(0,len(data))

for i,d in enumerate(data):
    ax.scatter(d.T[0], d.T[1], label='data set ' + str(i), 
c=np.ones(d.shape[0])*i,
            norm=norm)
ax.legend()
plt.show()
-----------


------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to