Hi all,

I am wondering if I can use scatter in connection with legend (attached test for details). I am using the latest svn version.

Any pointer would be appreciated.

Cheers,
           Nils
from scipy.optimize import *
from numpy import array, sum, linspace
from pylab import plot, scatter, show, savefig, xlabel, ylabel, legend

y = array((31,14,2.9,2.0))
x = array((0,6,12,18))


def mycost(c):
#    y_model = c[0] + c[1]**x
    y_model = c[0]*(c[1]**x) 
    error_vect = y - y_model
    return sum(error_vect**2)


c_initial_guess = [10, 0.5]            

c_final = fmin(mycost, c_initial_guess)
xr = linspace(0,18)
#yr = c_final[0] + c_final[1] ** xr
yr = c_final[0] *(c_final[1] ** xr)

print "***************************************************************"
print c_final
print "***************************************************************"
print xr
print "***************************************************************"
print yr
print "***************************************************************"

scatter(x,y)    # Doesn't work wrt legend
#plot(x,y,'ro') # Works for me wrt legend
plot(xr,yr)
legend(('Messdaten','Ausgleichskurve'),shadow=True)
show()
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to