## matplotlib-users

 [Matplotlib-users] finish. now improvement - help From: Samuel Teixeira Santos - 2010-02-18 17:56:24 Attachments: Message as HTML     comp.jpg
 Re: [Matplotlib-users] finish. now improvement - help From: Samuel Teixeira Santos - 2010-02-19 10:23:03 Attachments: Message as HTML ```anyone? please? Samuel 2010/2/18 Samuel Teixeira Santos > Hi all. > > I finish my test code to learn the basics of matplotlib. > > Here my simplest code: http://dpaste.com/161149/ > > Now what I ask is for suggestions about turn this in better code > > Because in some sites that teach using matplotlib, using some functions > like add a supblot etc > and I don't know if this way I did is the better, but it was the simplest I > got it. > > So... please make suggestions what interest to do for this code be faster > and better > Any type! > > And one question: There is a way to do in each point I draw relative to the > 'second' graph (x2,y2) > to put a specific legend? > > in attach i put a comparative figure between the equivalente graph in excel > > thanks for all in advanced > > see ya > > > Samuel > ```
 Re: [Matplotlib-users] finish. now improvement - help From: Pierre de Buyl - 2010-02-19 10:51:06 ```add """ import numpy """ at the beginning of your code. Then, y1=[Decimal('0.3041997084285048793446312110'), Decimal ('0.3041811120982812429734672735'), Decimal ('0.3041586008929715390350375366'), Decimal ('0.08256793883349254633032840545'), Decimal ('0.08255838341506859117962741714')] (just a subset of your data) goes to: y1 = numpy.array([0.3041997084285048793446312110 , 0.3041811120982812429734672735 , 0.3041586008929715390350375366 , 0.08256793883349254633032840545 , 0.08255838341506859117962741714 ] ) with similar modifications for x1,x2,y2. This takes less place. You do not need the "decimal" package in my opinion. Except if the raw data you get is the one with the "Decimal" indicators. > Here my simplest code: http://dpaste.com/161149/ > > Now what I ask is for suggestions about turn this in better code In what way ? What are your requirements ? > So... please make suggestions what interest to do for this code be > faster and better > Any type! Is it too slow ? Is there a reason why you are not satisfied ? > And one question: There is a way to do in each point I draw > relative to the 'second' graph (x2,y2) > to put a specific legend? If you want each point to have a separate legend, you should plot them separately: a plot(x2[i:i+1),y2[i:i+1],'ro') command for i in range(N_points). Good plotting, Pierre ```