1begin temperature t 2 # Define legend entries for various temperatures. 3 # 4 key "point", "temperature 20\260C", 20 5 key "point", "temperature 25\260C", 25 6 key "point", "temperature 30\260C", 30 7 key "point", "temperature 35\260C", 35 8 9 # Temperature is a value in range 20-35. Convert it to 10 # a color in the range green-yellow-red. 11 # 12 color interpolate("20 green 25 yellow 35 red", t) 13 box -2, -2, 2, 2 14 fill 15end 16 17# Display map of Australia. Then read temperature data from a file 18# and display January temperatures for some cities, with different 19# colors representing different temperatures. 20# 21newpage "eps", "tutorialattribute1.eps", 60, 40 22dataset "shapefile", "coastline.shp", "dbffields=" 23worlds -2800000, 4800000, 2150000, 9190000 24while Mapyrus.fetch.more 25do 26 fetch 27 clearpath 28 addpath GEOMETRY 29 stroke 30done 31dataset "textfile", "aust_cities.dat", "" 32while Mapyrus.fetch.more 33do 34 fetch 35 let cityname = $1 36 fetch 37 let x = $1, y = $2 38 clearpath 39 move x, y 40 fetch 41 let januaryTemperature = $1 42 temperature januaryTemperature 43 fetch 44done 45 46# Draw legend in separate PostScript file. 47# 48newpage "eps", "tutorialattribute1legend.eps", 40, 50, \ 49 "isolatinfonts=Helvetica" 50color "black" 51move 5, 5, 5, 10, 5, 15, 5, 20 52font "Helvetica", 2.5 53legend 4 54