1# plotdemos11.tcl -- 2# Test and demonstrate log X-Y plots and log-log plots 3# 4package require Plotchart 1.8 5 6# 7# Log X plot of y = log(x) 8# 9pack [canvas .c1 -bg white] 10 11set p [::Plotchart::createLogXYPlot .c1 {1 1000} {0 5 1}] 12 13foreach x {1 2 5 10 20 50 100 200 500 1000} { 14 $p plot series1 $x [expr {log($x)}] 15} 16 17$p title "y = log(x)" 18 19# 20# Log-log plot - use y = x**n 21# 22pack [canvas .c2 -bg white] -side top 23 24set p [::Plotchart::createLogXLogYPlot .c2 {1 1000} {1 1e6}] 25 26$p dataconfig series1 -colour green 27$p dataconfig series2 -colour blue 28$p dataconfig series3 -colour red 29 30foreach x {1 2 5 10 20 50 100 200 500 1000} { 31 $p plot series1 $x [expr {sqrt($x)}] 32 $p plot series2 $x [expr {$x*$x}] 33 $p plot series3 $x [expr {$x*sqrt($x)}] 34} 35 36$p title "y = x**n, n = 1/2, 2, 3/2" 37 38$p xticklines grey 39 40