/usr/share/doc/libplplot12/examples/tcl/x31.tcl is in plplot-tcl-dev 5.10.0+dfsg2-0.1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | #----------------------------------------------------------------------------
# $Id: x31.tcl 11574 2011-02-22 07:31:33Z arjenmarkus $
#----------------------------------------------------------------------------
proc x31 {{w loopback}} {
# Test setting / getting familying parameters before plinit.
# Save values set by plparseopts to be restored later.
$w cmd plgfam fam0 num0 bmax0
set fam1 0
set num1 10
set bmax1 1000
$w cmd plsfam $fam1 $num1 $bmax1
# Retrieve the same values?
$w cmd plgfam fam2 num2 bmax2
puts [ format "family parameters: fam, num, bmax = %d %d %d" $fam2 $num2 $bmax2 ]
if {$fam2 != $fam1 || $num2 != $num1 || $bmax2 != $bmax1} {
puts stderr "plgfam test failed"
set status 1
}
# Restore values set initially by plparseopts.
$w cmd plsfam $fam0 $num0 $bmax0
# Test setting / getting page parameters before plinit.
# Save values set by plparseopts to be restored later.
$w cmd plgpage xp0 yp0 xleng0 yleng0 xoff0 yoff0
set xp1 200.
set yp1 200.
set xleng1 400
set yleng1 200
set xoff1 10
set yoff1 20
$w cmd plspage $xp1 $yp1 $xleng1 $yleng1 $xoff1 $yoff1
# Retrieve the same values?
$w cmd plgpage xp2 yp2 xleng2 yleng2 xoff2 yoff2
puts [ format "page parameters: xp, yp, xleng, yleng, xoff, yoff = %f %f %d %d %d %d" $xp2 $yp2 $xleng2 $yleng2 $xoff2 $yoff2 ]
if {$xp2 != $xp1 || $yp2 != $yp1 || $xleng2 != $xleng1 || $yleng2 != $yleng1 || $xoff2 != $xoff1 || $yoff2 != $yoff1} {
puts stderr "plgpage test failed"
set status 1
}
# Restore values set initially by plparseopts.
$w cmd plspage $xp0 $yp0 $xleng0 $yleng0 $xoff0 $yoff0
# Test setting / getting compression parameter across plinit.
set compression1 95
$w cmd plscompression $compression1
$w cmd plinit
set status 0
# Test if device initialization screwed around with the preset
# compression parameter.
$w cmd plgcompression compression2
puts [ format "Output various PLplot parameters" ]
puts [ format "compression parameter = %d" $compression2 ]
if {$compression2 != $compression1} {
puts stderr "plgcompression test failed"
set status 1
}
# Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure
# they work without any obvious error messages.
$w cmd plscolor 1
matrix r1 i 2 = {0, 255}
matrix g1 i 2 = {255, 0}
matrix b1 i 2 = {0, 0}
matrix a1 f 2 = {1.0, 1.0}
$w cmd plscmap1 r1 g1 b1 2
$w cmd plscmap1a r1 g1 b1 a1 2
$w cmd plglevel level2
puts [ format "level parameter = %d" $level2 ]
if {$level2 != 1} {
puts stderr "plglevel test failed."
set status 1
}
$w cmd pladv 0
$w cmd plvpor 0.01 0.99 0.02 0.49
$w cmd plgvpd xmin xmax ymin ymax
puts [ format "plvpor: xmin, xmax, ymin, ymax = %f %f %f %f" $xmin $xmax $ymin $ymax ]
if {$xmin != 0.01 || $xmax != 0.99 || $ymin != 0.02 || $ymax != 0.49} {
puts stderr "plgvpd test failed"
set status 1
}
set xmid [ expr {0.5*($xmin+$xmax)} ]
set ymid [ expr {0.5*($ymin+$ymax)} ]
$w cmd plwind 0.2 0.3 0.4 0.5
$w cmd plgvpw xmin xmax ymin ymax
puts [ format "plwind: xmin, xmax, ymin, ymax = %f %f %f %f" $xmin $xmax $ymin $ymax ]
if {$xmin != 0.2 || $xmax != 0.3 || $ymin != 0.4 || $ymax != 0.5} {
puts stderr "plgvpw test failed"
set status 1
}
# Get world coordinates for middle of viewport
$w cmd plcalc_world $xmid $ymid wx wy win
puts [ format "world parameters: wx, wy, win = %f %f %d" $wx $wy $win ]
if {abs($wx-0.5*($xmin+$xmax)) > 1.0E-5 || abs($wy-0.5*($ymin+$ymax)) > 1.0E-5} {
puts stderr "plcalc_world test failed"
set status 1
}
# Retrieve and print the name of the output file (if any)
$w cmd plgfnam fnam
if {$fnam == ""} {
puts [ format "No output file name is set" ]
} {else} {
puts [ format "Output file name read" ]
}
puts stderr [ format "Output file name is %s" $fnam ]
# Set and get the number of digits used to display axis labels
# Note digits is currently ignored in pls[xyz]ax and
# therefore it does not make sense to test the returned value.
$w cmd plsxax 3 0
$w cmd plgxax digmax digits
puts [ format "x axis parameters: digmax, digits = %d %d" $digmax $digits ]
if {$digmax != 3} {
puts stderr "plgxax test failed"
set status 1
}
$w cmd plsyax 4 0
$w cmd plgyax digmax digits
puts [ format "y axis parameters: digmax, digits = %d %d" $digmax $digits ]
if {$digmax != 4} {
puts stderr "plgyax test failed"
set status 1
}
$w cmd plszax 5 0
$w cmd plgzax digmax digits
puts [ format "z axis parameters: digmax, digits = %d %d" $digmax $digits ]
if {$digmax != 5} {
puts stderr "plgzax test failed"
set status 1
}
$w cmd plsdidev 0.05 [expr {$::PLPLOT::PL_NOTSET}] 0.1 0.2
$w cmd plgdidev mar aspect jx jy
puts [ format "device-space window parameters: mar, aspect, jx, jy = %f %f %f %f" $mar $aspect $jx $jy ]
if {$mar != 0.05 || $jx != 0.1 || $jy != 0.2} {
puts stderr "plgdidev test failed"
set status 1
}
$w cmd plsdiori 1.0
$w cmd plgdiori ori
puts [ format "ori parameter = %f" $ori ]
if {$ori != 1.0 } {
puts stderr "plgdiori test failed"
set status 1
}
$w cmd plsdiplt 0.1 0.2 0.9 0.8
$w cmd plgdiplt xmin ymin xmax ymax
puts [ format "plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f" $xmin $ymin $xmax $ymax ]
if {$xmin != 0.1 || $xmax != 0.9 || $ymin != 0.2 || $ymax != 0.8} {
puts stderr "plgdiplt test failed"
set status 1
}
$w cmd plsdiplz 0.1 0.1 0.9 0.9
$w cmd plgdiplt zxmin zymin zxmax zymax
puts [ format "zoomed plot-space window parameters: xmin, ymin, xmax, ymax = %f %f %f %f" $zxmin $zymin $zxmax $zymax ]
if {abs($zxmin -($xmin + ($xmax-$xmin)*0.1)) > 1.0E-5 || abs($zxmax -($xmin+($xmax-$xmin)*0.9)) > 1.0E-5 || abs($zymin -($ymin+($ymax-$ymin)*0.1)) > 1.0E-5 || abs($zymax -($ymin+($ymax-$ymin)*0.9)) > 1.0E-5 } {
puts stderr "plsdiplz test failed"
set status 1
}
$w cmd plscolbg 10 20 30
$w cmd plgcolbg r g b
puts [ format "background colour parameters: r, g, b = %d %d %d" $r $g $b ]
if {$r != 10 || $g != 20 || $b != 30} {
puts stderr "plgcolbg test failed"
set status 1
}
$w cmd plscolbga 20 30 40 0.5
$w cmd plgcolbga r g b a
puts [ format "background/transparency colour parameters: r, g, b, a = %d %d %d %f" $r $g $b $a ]
if {$r != 20 || $g != 30 || $b != 40 || $a != 0.5} {
puts stderr "plgcolbga test failed"
set status 1
}
# Restore defaults
# $w cmd plcol0 1
$w cmd plend
}
|