This file is indexed.

/usr/share/doc/libplplot12/examples/tcl/x16.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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
#----------------------------------------------------------------------------
# $Id: x16.tcl 12431 2013-07-19 09:53:51Z arjenmarkus $
#----------------------------------------------------------------------------

# plshades demo, using color fill.

proc x16 {{w loopback}} {

    set ns 20
    set nx 35
    set ny 46

    set fill_width 2.; set cont_color 0; set cont_width 0.

    matrix clevel f $ns
    matrix shedge f [expr $ns+1]
    matrix xg1 f $nx
    matrix yg1 f $ny
    matrix xg2 f $nx $ny
    matrix yg2 f $nx $ny
    matrix zz f $nx $ny
    matrix ww f $nx $ny

# Colorbar - note: single values, as we have only one bar
    set n_axis_opts    1
    set axis_opts      "bcvtm"
    set axis_ticks     0.0
    set axis_subticks  0
    set label_opts     $::PLPLOT::PL_COLORBAR_LABEL_BOTTOM
    set labels         "Magnitude"

# Set up data array

    for {set i 0} {$i < $nx} {incr i} {
	set x [expr {double($i - ($nx/2)) / double($nx/2)}]
	for {set j 0} {$j < $ny} {incr j} {
	    set y [expr {double($j - $ny/2) / double($ny/2) - 1.}]

	    zz $i $j = [expr {-sin(7.*$x) * cos(7.*$y) + $x*$x - $y*$y} ]
	    ww $i $j = [expr {-cos(7.*$x) * sin(7.*$y) + 2 * $x * $y} ]
	}
    }

    set zmin [zz 0 0]
    set zmax $zmin
    for {set i 0} {$i < $nx} {incr i} {
	for {set j 0} {$j < $ny} {incr j} {
	    if {[zz $i $j] < $zmin} { set zmin [zz $i $j] }
	    if {[zz $i $j] > $zmax} { set zmax [zz $i $j] }
	}
    }

    for {set i 0} {$i < $ns} {incr i} {
	clevel $i = [expr {$zmin + ($zmax - $zmin) * ($i + .5) / double($ns)}]
    }

    for {set i 0} {$i < $ns+1} {incr i} {
	shedge $i = [expr {$zmin + ($zmax - $zmin) * double($i) / double($ns)}]
    }

# Build the 1-d coord arrays.

    set distort .4

    for {set i 0} {$i < $nx} {incr i} {
	set xx [expr {-1. + $i * ( 2. / ($nx-1.) )}]
	xg1 $i = [expr {$xx + $distort * cos( .5 * $::PLPLOT::PL_PI * $xx )} ]
    }

    for {set j 0} {$j < $ny} {incr j} {
	set yy [expr {-1. + $j * ( 2. / ($ny-1.) )}]
	yg1 $j = [expr {$yy - $distort * cos( .5 * $::PLPLOT::PL_PI * $yy )} ]
    }

# Build the 2-d coord arrays.

    for {set i 0} {$i < $nx} {incr i} {
	set xx [expr {-1. + $i * ( 2. / ($nx-1.) )}]
	for {set j 0} {$j < $ny} {incr j} {
	    set yy [expr {-1. + $j * ( 2. / ($ny-1.) )}]

	    set argx [expr {.5 * $::PLPLOT::PL_PI * $xx}]
	    set argy [expr {.5 * $::PLPLOT::PL_PI * $yy}]

	    xg2 $i $j = [expr {$xx + $distort * cos($argx) * cos($argy)} ]
	    yg2 $i $j = [expr {$yy - $distort * cos($argx) * cos($argy)} ]
	}
    }

# Plot using identity transform

    $w cmd pladv 0
    $w cmd plvpor 0.1 0.9 0.1 0.9
    $w cmd plwind -1.0 1.0 -1.0 1.0

    $w cmd plpsty 0

    $w cmd plshades zz -1. 1. -1. 1. \
      shedge $fill_width $cont_color $cont_width \
      1 "NULL"

    # Colorbar:
    # We draw only one bar, so use single values, not lists
    #
    # Smaller text
    $w cmd plschr 0.0 0.75
    # Small ticks on the vertical axis
    $w cmd plsmaj 0.0 0.5
    $w cmd plsmin 0.0 0.5

    $w cmd plcolorbar \
        [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \
        0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \
        $cont_color $cont_width \
        $label_opts $labels \
        $axis_opts \
        $axis_ticks $axis_subticks \
        shedge

    # Reset text and tick sizes
    $w cmd plschr 0.0 1.0
    $w cmd plsmaj 0.0 1.0
    $w cmd plsmin 0.0 1.0

    $w cmd plcol0 1
    $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0
    $w cmd plcol0 2

#    plcont(w, nx, ny, 1, nx, 1, ny, clevel, ns, mypltr, NULL);

    $w cmd pllab "distance" "altitude" "Bogon density"

# Plot using 1d coordinate transform

    $w cmd plspal0 "cmap0_black_on_white.pal"
    $w cmd plspal1 "cmap1_blue_yellow.pal" 1

    $w cmd pladv 0
    $w cmd plvpor 0.1 0.9 0.1 0.9
    $w cmd plwind -1.0 1.0 -1.0 1.0

    $w cmd plpsty 0

    $w cmd plshades zz -1. 1. -1. 1. \
      shedge $fill_width $cont_color $cont_width \
      1 pltr1 xg1 yg1

    # Colorbar:
    # We draw only one bar, so use single values, not lists
    #
    # Smaller text
    $w cmd plschr 0.0 0.75
    # Small ticks on the vertical axis
    $w cmd plsmaj 0.0 0.5
    $w cmd plsmin 0.0 0.5

    $w cmd plcolorbar \
        [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \
        0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \
        $cont_color $cont_width \
        $label_opts $labels \
        $axis_opts \
        $axis_ticks $axis_subticks \
        shedge

    # Reset text and tick sizes
    $w cmd plschr 0.0 1.0
    $w cmd plsmaj 0.0 1.0
    $w cmd plsmin 0.0 1.0

    $w cmd plcol0 1
    $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0
    $w cmd plcol0 2

#    plcont(w, nx, ny, 1, nx, 1, ny, clevel, ns, pltr1, (void *) &cgrid1);

    $w cmd pllab "distance" "altitude" "Bogon density"

# Plot using 2d coordinate transform

    $w cmd plspal0 "cmap0_black_on_white.pal"
    $w cmd plspal1 "cmap1_blue_red.pal" 1

    $w cmd pladv 0
    $w cmd plvpor 0.1 0.9 0.1 0.9
    $w cmd plwind -1.0 1.0 -1.0 1.0

    $w cmd plpsty 0

    $w cmd plshades zz -1. 1. -1. 1. \
      shedge $fill_width $cont_color $cont_width \
      0 pltr2 xg2 yg2

    # Colorbar:
    # We draw only one bar, so use single values, not lists
    #
    # Smaller text
    $w cmd plschr 0.0 0.75
    # Small ticks on the vertical axis
    $w cmd plsmaj 0.0 0.5
    $w cmd plsmin 0.0 0.5

    $w cmd plcolorbar \
        [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \
        0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \
        $cont_color $cont_width \
        $label_opts $labels \
        $axis_opts \
        $axis_ticks $axis_subticks \
        shedge

    # Reset text and tick sizes
    $w cmd plschr 0.0 1.0
    $w cmd plsmaj 0.0 1.0
    $w cmd plsmin 0.0 1.0

    $w cmd plcol0 1
    $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0
    $w cmd plcol0 2
    $w cmd plcont ww clevel pltr2 xg2 yg2

    $w cmd pllab "distance" "altitude" "Bogon density, with streamlines"

# Plot using 2d coordinate transform with both shades and contours.

    $w cmd plspal0 ""
    $w cmd plspal1 "" 1

    $w cmd pladv 0
    $w cmd plvpor 0.1 0.9 0.1 0.9
    $w cmd plwind -1.0 1.0 -1.0 1.0

    $w cmd plpsty 0

    $w cmd plshades zz -1. 1. -1. 1. \
      shedge $fill_width 2 3 \
      0 pltr2 xg2 yg2

    # Colorbar:
    # We draw only one bar, so use single values, not lists
    #
    # Smaller text
    $w cmd plschr 0.0 0.75
    # Small ticks on the vertical axis
    $w cmd plsmaj 0.0 0.5
    $w cmd plsmin 0.0 0.5

    $w cmd plcolorbar \
        [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \
        0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \
        2 3.0 \
        $label_opts $labels \
        $axis_opts \
        $axis_ticks $axis_subticks \
        shedge

    # Reset text and tick sizes
    $w cmd plschr 0.0 1.0
    $w cmd plsmaj 0.0 1.0
    $w cmd plsmin 0.0 1.0

    $w cmd plcol0 1
    $w cmd plbox "bcnst" 0.0 0 "bcnstv" 0.0 0
    $w cmd plcol0 2

    $w cmd pllab "distance" "altitude" "Bogon density"

# Polar plot example demonstrating wrapping support.

    $w cmd plspal0 "cmap0_black_on_white.pal"
    $w cmd plspal1 "cmap1_gray.pal" 1

# Build the new coordinate matrices.

    set nylim [expr $ny - 1]; set wrap 2;
    matrix xg f $nx $nylim
    matrix yg f $nx $nylim
    matrix z  f $nx $nylim

    for {set i 0} {$i < $nx} {incr i} {
	set r [expr {$i / ($nx - 1.)}]
	for {set j 0} {$j < $nylim} {incr j} {
	    set t [expr {2. * $::PLPLOT::PL_PI * $j / ($ny - 1.)}]

	    xg $i $j = [expr {$r * cos($t)}]
	    yg $i $j = [expr {$r * sin($t)}]

	    z $i $j = [expr {exp(-$r*$r) * cos(5.*$t) * cos(5.*$::PLPLOT::PL_PI*$r)} ]
	}
    }

# Need a new shedge to go along with the new data set.

    set zmin [z 0 0]
    set zmax $zmin
    for {set i 0} {$i < $nx} {incr i} {
	for {set j 0} {$j < $nylim} {incr j} {
	    if {[z $i $j] < $zmin} { set zmin [z $i $j] }
	    if {[z $i $j] > $zmax} { set zmax [z $i $j] }
	}
    }

    for {set i 0} {$i < [expr $ns+1]} {incr i} {
	shedge $i = [expr {$zmin + ($zmax - $zmin)/double($ns) * double($i)}]
    }

    $w cmd pladv 0
    $w cmd plvpor 0.1 0.9 0.1 0.9
    $w cmd plwind -1.0 1.0 -1.0 1.0

    $w cmd plpsty 0

    $w cmd plshades z -1. 1. -1. 1. \
      shedge $fill_width $cont_color $cont_width \
      0 pltr2 xg yg $wrap

    # Colorbar:
    # We draw only one bar, so use single values, not lists
    #
    # Smaller text
    $w cmd plschr 0.0 0.75
    # Small ticks on the vertical axis
    $w cmd plsmaj 0.0 0.5
    $w cmd plsmin 0.0 0.5

    $w cmd plcolorbar \
        [expr {$::PLPLOT::PL_COLORBAR_SHADE | $::PLPLOT::PL_COLORBAR_SHADE_LABEL}] 0 \
        0.005 0.0 0.0375 0.875 0 1 1 0.0 0.0 \
        $cont_color $cont_width \
        $label_opts $labels \
        $axis_opts \
        $axis_ticks $axis_subticks \
        shedge

    # Reset text and tick sizes
    $w cmd plschr 0.0 1.0
    $w cmd plsmaj 0.0 1.0
    $w cmd plsmin 0.0 1.0

# Hold perimeter
    matrix px f 100; matrix py f 100

    for {set i 0} {$i < 100} {incr i} {
	set t [expr {2. * $::PLPLOT::PL_PI * $i / 99.}]
	px $i = [expr {cos($t)}]
	py $i = [expr {sin($t)}]
    }
# draw the perimeter.
    $w cmd plcol0 1
    $w cmd plline 100 px py

# And label the plot.
    $w cmd plcol0 2
    $w cmd pllab "" "" "Tokamak Bogon Instability"
# Restore defaults
    # $w cmd plcol0 1
}