| 1 |
proc FormatAxisLabel {graph x} { |
| 2 |
return "[expr int($x)]\260" |
| 3 |
} |
| 4 |
|
| 5 |
set configOptions [subst { |
| 6 |
Axis.Hide no |
| 7 |
Axis.Limits "%g" |
| 8 |
Axis.TickFont { helvetica 12 bold } |
| 9 |
Axis.TitleFont { helvetica 12 bold } |
| 10 |
BorderWidth 1 |
| 11 |
Element.Pixels 1.75m |
| 12 |
Element.ScaleSymbols yes |
| 13 |
Font { helvetica 23 bold } |
| 14 |
Legend.ActiveBorderWidth 2 |
| 15 |
Legend.ActiveRelief raised |
| 16 |
Legend.Anchor ne |
| 17 |
Legend.BorderWidth 0 |
| 18 |
Legend.Font { Helvetica 24 } |
| 19 |
Legend.Position plotarea |
| 20 |
Relief sunken |
| 21 |
Title "Sine and Cosine Functions" |
| 22 |
x.Command [namespace current]::FormatAxisLabel |
| 23 |
x.StepSize 90 |
| 24 |
x.Subdivisions 0 |
| 25 |
x.Title "X" |
| 26 |
y.Color purple2 |
| 27 |
y.Loose no |
| 28 |
y.Title "Y" |
| 29 |
y.rotate 90 |
| 30 |
y2.color magenta3 |
| 31 |
}] |
| 32 |
|
| 33 |
set resName [string trimleft $graph .] |
| 34 |
foreach { option value } $configOptions { |
| 35 |
option add *$resName.$option $value |
| 36 |
} |
| 37 |
|
| 38 |
$graph configure -leftvar changed |
| 39 |
|
| 40 |
set tcl_precision 15 |
| 41 |
set pi1_2 [expr 3.14159265358979323846/180.0] |
| 42 |
|
| 43 |
vector create x sinX cosX -variable "" |
| 44 |
x seq -360 360 5 |
| 45 |
sinX expr { sin(x*$pi1_2) } |
| 46 |
cosX expr { cos(x*$pi1_2) } |
| 47 |
|
| 48 |
$graph element create line1 \ |
| 49 |
-label "sin(x)" \ |
| 50 |
-fill orange \ |
| 51 |
-color black \ |
| 52 |
-x x \ |
| 53 |
-y sinX |
| 54 |
$graph element create line2 \ |
| 55 |
-label "cos(x)" \ |
| 56 |
-color yellow4 \ |
| 57 |
-fill yellow \ |
| 58 |
-x x \ |
| 59 |
-y cosX |
| 60 |
|
| 61 |
Blt_ZoomStack $graph |
| 62 |
Blt_Crosshairs $graph |
| 63 |
Blt_ActiveLegend $graph |
| 64 |
Blt_ClosestPoint $graph |
| 65 |
#Blt_PrintKey $graph |
| 66 |
|
| 67 |
$graph marker create bitmap \ |
| 68 |
-name bg \ |
| 69 |
-coords "-360 -1 360 1" \ |
| 70 |
-bitmap @bitmaps/greenback.xbm \ |
| 71 |
-bg darkseagreen1 \ |
| 72 |
-fg darkseagreen3 \ |
| 73 |
-under yes \ |
| 74 |
-rotate 45 |
| 75 |
# -rotate 45 |
| 76 |
$graph postscript configure \ |
| 77 |
-maxpect yes \ |
| 78 |
-landscape yes |
| 79 |
|