## matplotlib-users

 [Matplotlib-users] legend with scatter From: Emmanuel Favre-Nicolin - 2006-04-06 15:11:22 ```Hi, when I use legend() with a scatter plot I obtain an empty legend. A test script: from pylab import figure, load, show,legend,arange x=arange(-2,2.1,0.2) fig = figure() ax = fig.add_subplot(111) ax.scatter(x,x*x,label="x*x") ax.legend() show() If I replace scatter by plot, legend is OK. Follow a test script : from pylab import figure, load, show,legend,arange x=arange(-2,2.1,0.2) fig = figure() ax = fig.add_subplot(111) ax.plot(x,x*x,label="x*x") ax.legend() show() I'd like to use scatter which produce nice scattered plot and have legend. What could I do? Emmanuel ```
 Re: [Matplotlib-users] legend with scatter From: Emmanuel Favre-Nicolin - 2006-04-06 17:19:40 ```Le Jeudi 06 Avril 2006 12:21, Emmanuel Favre-Nicolin a =E9crit=A0: > Hi, > > when I use legend() with a scatter plot I obtain an empty legend. A test > script: > > from pylab import figure, load, show,legend,arange > x=3Darange(-2,2.1,0.2) > fig =3D figure() > ax =3D fig.add_subplot(111) > ax.scatter(x,x*x,label=3D"x*x") > ax.legend() > show() > > > If I replace scatter by plot, legend is OK. Follow a test script : > > from pylab import figure, load, show,legend,arange > x=3Darange(-2,2.1,0.2) > fig =3D figure() > ax =3D fig.add_subplot(111) > ax.plot(x,x*x,label=3D"x*x") > ax.legend() > show() > > I'd like to use scatter which produce nice scattered plot and have legend. > What could I do? OK I can use plot with circle, it's fine. I was just wondering if scatter()= =20 should not function like plot()? ```
 [Matplotlib-users] Re: legend with scatter From: Jouni K Seppanen - 2006-04-06 18:43:15 Attachments: Message as HTML     legend.patch     Message as HTML