1# plotdemos17.tcl -- 2# Demonstrate how to configure the axes 3# 4# 5source ../../plotchart.tcl 6package require Plotchart 7 8 9# 10# Set up three plots 11# 12pack [canvas .c1 -bg white -width 400 -height 300] 13pack [canvas .c2 -bg white -width 400 -height 300] 14pack [canvas .c3 -bg white -width 400 -height 200] 15 16set p1 [::Plotchart::createXYPlot .c1 {0 10 2} {-1 1 0.25}] 17$p1 ytext "(V)" 18$p1 xconfig -ticklength 20 -format %.3f 19$p1 yconfig -ticklength 20 -minorticks 4 -labeloffset 10 20 21set p2 [::Plotchart::createXYPlot .c2 {0 10 2} {-10 10 5}] 22$p2 ytext "(mA)" 23 24$p2 dataconfig current -colour red 25$p2 xconfig -ticklength -6 -minorticks 1 26 27# 28# Fill in some data 29# 30for {set i 0} {$i < 100} {incr i} { 31 set phase [expr {2.0*3.1415926*$i/50.0}] 32 33 $p1 plot voltage $phase [expr {0.9*cos($phase)}] 34 $p2 plot current $phase [expr {7*sin($phase)}] 35} 36 37 38# 39# The third plot uses -xlabes and -ylabels to control 40# the labelling 41# 42set p3 [::Plotchart::createXYPlot .c3 {0 10} {-10 10} -xlabels {1 4 6} -ylabels {-5 0}] 43