From: Benjamin R. <ben...@ou...> - 2012-06-14 23:58:25
|
On Thursday, June 14, 2012, Daπid wrote: > First, this is another topic, so please, change the subject of the > message so it doesn't get messed up with others (and possible help > lost in the process). > > Now, you are indeed plotting one dot at the time and generating a > label for it. If you don't want that, you have to plot the whole list > at the time: > > > x=[rand() for i in xrange(10)] > y=[rand() for i in xrange(10)] > > scatter(x,y, label='points') > legend() > show() > > where the definition of x includes a list comprehension (equivalent at > "for i in xrange(10): x.append(rand())" ). > > On another topic, people are not usually fan of using from MODULEX > import *, as it can turn into poor code and name collisions. It is > nicer if you write "import pylab as plt", and refer to the functions > as plt.scatter and so on. > > > Regards. Point of style: in general, yes, but pylab was intended for that to help transition matlab users. Pylab really shouldn't be loaded as plt, because that is what pyplot is usually imported as. Of course, this is all just a matter of style and preference. Cheers ! Ben Root |