;---------------------------------------------------------------------- ; This script demonstrates the use of function codes. ; ; This graphic is used in the Graphics workshop lecture slides. ;---------------------------------------------------------------------- begin wks = gsn_open_wks("png","fcodes") string1 = "Superscripts: x~S~2~N~ + y~S~2~N~" string1 = "Superscripts: x~S~2~N~ + y~S~2~N~" string2 = "Subscripts: CH~B~4~N~ + N~B~2~N~O" string3 = "Carriage~C~Return" string4 = "Happy ~F35~r~F~ Valentine's Day" txres = True txres@txJust = "CenterLeft" ;---Draw the strings without the formatting txres@txFontHeightF = 0.025 txres@txFuncCode = "$" txres@txFont = "Courier" gsn_text_ndc(wks,string1,0.05,0.97,txres) gsn_text_ndc(wks,string2,0.05,0.77,txres) gsn_text_ndc(wks,string3,0.05,0.57,txres) ;---This is the Valentine's string txres@txFontColor = "red" gsn_text_ndc(wks,string4,0.05,0.37,txres) ;---Draw the strings with the formatting txres@txFontColor = "black" txres@txFontHeightF = 0.03 txres@txFont = "helvetica" txres@txFuncCode = "~" gsn_text_ndc(wks,string1,0.05,0.9,txres) gsn_text_ndc(wks,string2,0.05,0.7,txres) gsn_text_ndc(wks,string3,0.05,0.5,txres) ;---This is the Valentine's string txres@txFontColor = "red" gsn_text_ndc(wks,string4,0.05,0.3,txres) frame(wks) end