1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#! /bin/sh
# -*- tcl -*- \
exec tclsh "$0" ${1+"$@"}
#
# Demonstrate the region and minmax commands
#
package require Tcl
package require Tk
package require Plotchart
namespace import Plotchart::*
catch {destroy .c}
canvas .c -background white -width 600 -height 400
canvas .c2 -background white -width 600 -height 400
pack .c .c2 -fill both -side top
plotstyle configure default polarplot axis shownumbers 0
plotstyle configure default polarplot axis ticklength 0
plotstyle configure default polarplot axis ticklength 0
plotstyle configure default polarplot axis color darkgrey
set p [createPolarplot .c {3.0 3.0}]
set p2 [createXYPlot .c2 {0.0 100.0 20.0} {0.0 3.0 1.0}]
set c [$p canvas]
#
# Define a region in polar coordinates - a cardioid
#
set radii [list]
set angles [list]
$p dataconfig test -fillcolour lightgreen -width 4
for { set angle 0 } { $angle < 360.0 } { set angle [expr {$angle+10.0}] } {
set radius [expr {1.0+cos($angle*$::Plotchart::torad)}]
lappend radii $radius
lappend angles $angle
}
$p region test $radii $angles
#
# Define a min/max band - broken into two pieces
#
$p2 dataconfig test -fillcolour lightblue -colour {}
$p2 dataconfig line -width 2
$p2 minmax test 0 0.5 1.2
$p2 minmax test 40 0.7 1.7
$p2 minmax test 60 0.7 1.8
$p2 minmax test 60 {} {}
$p2 minmax test 65 0.8 2.5
$p2 minmax test 85 0.8 2.8
$p2 minmax test 100 0.9 2.2
$p2 plot line 0.0 1.0
$p2 plot line 25.0 1.2
$p2 plot line 60.0 2.0
$p2 plot line 70.0 1.7
$p2 plot line 95.0 1.4
after 0 $c raise data
|