/usr/share/doc/libplplot12/examples/tcl/plgrid.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 | #----------------------------------------------------------------------------
# $Id: plgrid.tcl 11645 2011-03-18 10:27:12Z andrewross $
#
# Demo polar grid plotter
#
#
# This programme uses the loopback widget so it can be run from either pltcl
# with a choice of the standard drivers or plserver with the plframe widget.
# (1) pltcl:
# execute pltcl and type plinit to get a selection of
# device types. Choose one of the devices then type
# "source plgrid.tcl" (this file), then type "plgrid"
# with no arguments.
# (2) plserver
# execute plserver then type the following (see ../tk/tkdemos.tcl for
# many other working examples of this method).
# plstdwin .
# plxframe .plw
# pack append . .plw {left expand fill}
# source plgrid.tcl
# proc 1 {} "plgrid .plw.plwin"
# to execute this procedure that you have just created execute the "1"
# command.
#----------------------------------------------------------------------------
proc plgrid {{w loopback}} {
set ni 10
set nj 20
set nj1 [expr $nj + 1]
matrix xi f $ni
matrix yi f $ni
matrix xj f $nj1
matrix yj f $nj1
set dr [expr 1. / $ni]
set dtheta [expr 2. * 3.14159265358979323846 / $nj]
# Set up viewport and window, but do not draw box
$w cmd plssub 1 1
$w cmd plcol0 1
$w cmd plenv -1.3 1.3 -1.3 1.3 1 -2
# Draw i-lines
for {set i 0} {$i < $ni} {incr i} {
for {set j 0} {$j < $nj1} {incr j} {
set r [expr $i * $dr]
set theta [expr $j * $dtheta]
set psi [expr $theta + 0.5 * $r * sin($theta)]
xj $j = [expr $r * cos($psi)]
yj $j = [expr $r * sin($psi)]
}
$w cmd plline $nj1 xj yj
}
# Draw j-lines
for {set j 0} {$j < $nj} {incr j} {
for {set i 0} {$i < $ni} {incr i} {
set r [expr $i * $dr]
set theta [expr $j * $dtheta]
set psi [expr $theta + 0.5 * $r * sin($theta)]
xi $i = [expr $r * cos($psi)]
yi $i = [expr $r * sin($psi)]
}
$w cmd plline $ni xi yi
}
}
|