Hi,
I'm just learning Python and I'm wondering if someone could help me get the chart to render properly in the following code, i.e. plot the sequence of data points. I have put print statements so I can see if the calculations are correct which they are.
Thanks
I'm just learning Python and I'm wondering if someone could help me get the chart to render properly in the following code, i.e. plot the sequence of data points. I have put print statements so I can see if the calculations are correct which they are.
Thanks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from pylab import * # Returns the summer tterature of seawater (in degrees Celsius) according to Mackenzie’s model. def some_function(ff, dd): if dd > = 0 and dd < = 200 : tt = ( 22 / - 90 ) * ff + 24 elif dd > = 200 and dd < = 1000 : st = ( 22 / - 90 ) * (ff) + 24 gg = (st - 2 ) / - 800 tt = gg * dd + (gg * - 1000 + 2 ) else : tt = 2.0 return tt ff = float ( 25 ) for dd in range ( 0 , 1200 , 100 ): tt1 = some_function(ff, dd) plot(dd,tt1) print (dd) print (tt1) title( "Something" ) xlabel( "x label" ) ylabel( "y label" ) show() |