Benjamin Root <ben.r...@...> writes: > <snip> > Probably not directly, but I hadn't thought about that before. For a set of > scatter points that are colored by values, what should the legend show? In > other words, what does it *mean* for there to be a legend for points that are > colored in a potentially non-uniform manner?So, maybe this is desired > behavior > (but possibly by accident)? > Thanks for your help, > Ben Root
I thought for a moment that legend was using the color of the first point in the set, but a quick test reveals that no matter what colormap you specify, the marker color inside the legend is blue. BTW, I think I've found another thing related to legend() and scatter plots: the 'numpoints' keyword argument to legend is not respected, as showed in the example pasted below, Jorge ------- 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)) cmap = mpl.cm.afmhot sc = [] labels = [] for i,d in enumerate(data): sc.append(ax.scatter(d.T[0], d.T[1], c=np.ones(d.shape[0])*i, norm=norm, cmap=cmap)) labels.append('data set ' + str(i)) ax.legend(sc, labels, numpoints=1) 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