Celsius Fahrenheit Graph

The code given below produces the following graph.

 

uorscale = 10000

activewidth = 1

activeheight = 1

activecolor = 0

activeangle = 0

activejustification = 7

for tc = -40 to 40 step 5

Tf = ( 9.0 / 5.0) * Tc + 32

p tc," C = ",tf, "F"

! change the color or bar graph depending on the temperature

if tf < 200 then

activecolor = red

endif

if tf < 80 then

activecolor = green

endif

if tf <= 32 then

activecolor = cyan

endif

 

if tf <= 0 then

activecolor = blue

endif

placeblock tc,0,tc+2,tf,"fill"

activecolor = 0

placetext tc,-2,stri$(tc) ! draw x axis text label -40,-35,-30 .....

next

! draw y axis text labels ,-40, -35, -30 ....

activecolor = 0

for tf = -40 to 105 step 5

placetext -44,tf,stri$(tf)

next

! Draw the x and y axis lines

activecolor = 2 ! draw axis lines color 2, green

activeweight = 5 ! draw the axis lines thick

placeline -40,0,42,0

placeline -40,0,-40,105

activeweight = 0 ! reset weight back to 0

! End draw axis lines

 

activewidth = 3

activeheight = 3

placetext 0,-5,"Celsius"

activeangle = 90

placetext -50,40,"Fahrenheit"