/usr/share/doc/libplplot11/examples/f77/x31f.f is in libplplot-dev 5.9.9-2ubuntu2.
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 | c $Id: x31f.fm4 11680 2011-03-27 17:57:51Z airwin $
c set / get tester.
c
c Copyright (C) 2008 Alan W. Irwin
c Copyright (C) 2008 Andrew Ross
c
c This file is part of PLplot.
c
c PLplot is free software; you can redistribute it and/or modify
c it under the terms of the GNU Library General Public License as
c published by the Free Software Foundation; either version 2 of the
c License, or (at your option) any later version.
c
c PLplot is distributed in the hope that it will be useful,
c but WITHOUT ANY WARRANTY; without even the implied warranty of
c MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c GNU Library General Public License for more details.
c
c You should have received a copy of the GNU Library General Public
c License along with PLplot; if not, write to the Free Software
c Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
c--------------------------------------------------------------------------
c main
c
c Demonstrates absolute positioning of graphs on a page.
c--------------------------------------------------------------------------
implicit none
include 'plplot_parameters.h'
real*8 xmin, xmax, ymin, ymax, zxmin, zxmax, zymin, zymax
real*8 xmid, ymid, wx, wy
real*8 mar, aspect, jx, jy, ori
integer win, level2, digmax, digits, compression1, compression2
real*8 xp0, yp0, xp1, yp1, xp2, yp2
integer xleng0, yleng0, xoff0, yoff0, xleng1, yleng1, xoff1, yoff1
integer xleng2, yleng2, xoff2, yoff2
integer fam0, num0, bmax0, fam1, num1, bmax1, fam2, num2, bmax2
integer r, g, b
real*8 a
integer r1(2), g1(2), b1(2)
data r1 /0, 255/
data g1 /255, 0/
data b1 /0, 0/
real*8 a1(2)
data a1 /1.0d0, 1.0d0/
character*256 fnam
integer stderr
integer status
integer lnblnk
c Parse and process command line arguments
status = 0
stderr = 0
call plparseopts(PL_PARSE_FULL)
c Test setting / getting familying parameters before plinit
c Save values set by plparseopts to be restored later.
call plgfam(fam0, num0, bmax0)
fam1 = 0
num1 = 10
bmax1 = 1000
call plsfam(fam1, num1, bmax1)
c Retrieve the same values?
call plgfam(fam2, num2, bmax2)
write(*,'(A,I1,I3,I5)') 'family parameters: fam, num, bmax = ',
& fam2, num2, bmax2
if (fam2 .ne. fam1 .or. num2 .ne. num1 .or. bmax2 .ne. bmax1) then
write(stderr,*) 'plgfam test failed'
status = 1
endif
c Restore values set initially by plparseopts.
call plsfam(fam0, num0, bmax0)
c Test setting / getting page parameters before plinit
c Save values set by plparseopts to be restored later.
call plgpage(xp0, yp0, xleng0, yleng0, xoff0, yoff0)
xp1 = 200.d0
yp1 = 200.d0
xleng1 = 400
yleng1 = 200
xoff1 = 10
yoff1 = 20
call plspage(xp1, yp1, xleng1, yleng1, xoff1, yoff1)
c Retrieve the same values?
call plgpage(xp2, yp2, xleng2, yleng2, xoff2, yoff2)
write(*,'(A,2F11.6, 2I4, 2I3)')
& 'page parameters: xp, yp, xleng, yleng, xoff, yoff =',
& xp2, yp2, xleng2, yleng2, xoff2, yoff2
if (xp2 .ne. xp1 .or. yp2 .ne. yp1 .or. xleng2 .ne. xleng1 .or.
& yleng2 .ne. yleng1 .or. xoff2 .ne. xoff1 .or.
& yoff2 .ne. yoff1 ) then
write(stderr,*) 'plgpage test failed'
status = 1
endif
c Restore values set initially by plparseopts.
call plspage(xp0, yp0, xleng0, yleng0, xoff0, yoff0)
c Test setting / getting compression parameter across plinit
compression1 = 95
call plscompression(compression1)
c Test setting / getting familying parameters across plinit
fam1 = 0
num1 = 10
bmax1 = 1000
call plsfam(fam1, num1, bmax1)
c Test setting / getting page parameters across plinit
xp1 = 200.d0
yp1 = 200.d0
xleng1 = 400
yleng1 = 200
xoff1 = 10
yoff1 = 20
call plspage(xp1, yp1, xleng1, yleng1, xoff1, yoff1)
c Initialize plplot
call plinit()
c Test if device initialization screwed around with the preset
c compression parameter.
call plgcompression(compression2)
write(*,'(A)') 'Output various PLplot parameters'
write(*,'(A,I2)') 'compression parameter = ', compression2
if (compression2 .ne. compression1) then
write(stderr,*) 'plgcompression test failed'
status = 1
endif
c Exercise plscolor, plscol0, plscmap1, and plscmap1a to make sure
c they work without any obvious error messages.
call plscolor(1)
call plscol0(1, 255, 0, 0)
call plscmap1(r1,g1,b1,2)
call plscmap1a(r1,g1,b1,a1,2)
call plglevel(level2)
write(*,'(A,I1)') 'level parameter = ', level2
if (level2 .ne. 1) then
write(stderr,*) 'plglevel test failed.'
status = 1
endif
call pladv(0)
call plvpor(0.01d0, 0.99d0, 0.02d0, 0.49d0)
call plgvpd(xmin, xmax, ymin, ymax)
write(*,'(A,4F9.6)') 'plvpor: xmin, xmax, ymin, ymax =',
& xmin, xmax, ymin, ymax
if (xmin .ne. 0.01d0 .or. xmax .ne. 0.99d0 .or.
& ymin .ne. 0.02d0 .or. ymax .ne. 0.49d0) then
write(stderr,*) 'plgvpd test failed'
status = 1
endif
xmid = 0.5*(xmin+xmax)
ymid = 0.5*(ymin+ymax)
call plwind(0.2d0, 0.3d0, 0.4d0, 0.5d0)
call plgvpw(xmin, xmax, ymin, ymax)
write(*,'(A,4F9.6)') 'plwind: xmin, xmax, ymin, ymax =',
& xmin, xmax, ymin, ymax
if (xmin .ne. 0.2d0 .or. xmax .ne. 0.3d0 .or. ymin .ne. 0.4d0 .or.
& ymax .ne. 0.5d0) then
write(stderr,*) 'plgvpw test failed',xmin,xmax,ymin,ymax
status = 1
endif
c Get world coordinates for midpoint of viewport
call plcalc_world(xmid,ymid,wx,wy,win)
write(*,'(A,2F9.6,I2)') 'world parameters: wx, wy, win =',
& wx, wy, win
if (abs(wx-0.25d0).gt.1.0d-5 .or. abs(wy-0.45d0).gt.1.0d-5) then
write(stderr,*) 'plcalc_world test failed'
status = 1
endif
c Retrieve and print the name of the output file (if any)
call plgfnam(fnam)
if (lnblnk(fnam) .eq. 0) then
write(*,'(A)') 'No output file name is set'
else
write(*,'(A)') 'Output file name read'
endif
write(stderr,'(A,A)') 'Output file name is ', fnam(:lnblnk(fnam))
c Set and get the number of digits used to display axis labels
c Note digits is currently ignored in pls[xyz]ax and
c therefore it does not make sense to test the returned
c value
call plsxax(3,0)
call plgxax(digmax,digits)
write(*,'(A,I2,I2)') 'x axis parameters: digmax, digits =',
& digmax, digits
if (digmax .ne. 3) then
write(stderr,*) 'plgxax test failed'
status = 1
endif
call plsyax(4,0)
call plgyax(digmax,digits)
write(*,'(A,I2,I2)') 'y axis parameters: digmax, digits =',
& digmax, digits
if (digmax .ne. 4) then
write(stderr,*) 'plgyax test failed'
status = 1
endif
call plszax(5,0)
call plgzax(digmax,digits)
write(*,'(A,I2,I2)') 'z axis parameters: digmax, digits =',
& digmax, digits
if (digmax .ne. 5) then
write(stderr,*) 'plgzax test failed'
status = 1
endif
call plsdidev(0.05d0, PL_NOTSET, 0.1d0, 0.2d0)
call plgdidev(mar, aspect, jx, jy)
write(*,'(A,4F9.6)') 'device-space window parameters: '//
& 'mar, aspect, jx, jy =', mar, aspect, jx, jy
if (mar .ne. 0.05d0 .or. jx .ne. 0.1d0 .or. jy .ne. 0.2d0) then
write(stderr,*) 'plgdidev test failed'
status = 1
endif
call plsdiori(1.0d0)
call plgdiori(ori)
write(*,'(A,F9.6)') 'ori parameter =', ori
if (ori .ne. 1.0d0) then
write(stderr,*) 'plgdiori test failed'
status = 1
endif
call plsdiplt(0.1d0, 0.2d0, 0.9d0, 0.8d0)
call plgdiplt(xmin, ymin, xmax, ymax)
write(*,'(A,4F9.6)') 'plot-space window parameters: '//
& 'xmin, ymin, xmax, ymax =', xmin, ymin, xmax, ymax
if (xmin .ne. 0.1d0 .or. xmax .ne. 0.9d0 .or. ymin .ne. 0.2d0 .or.
& ymax .ne. 0.8d0) then
write(stderr,*) 'plgdiplt test failed'
status = 1
endif
call plsdiplz(0.1d0, 0.1d0, 0.9d0, 0.9d0)
call plgdiplt(zxmin, zymin, zxmax, zymax)
write(*,'(A,4F9.6)') 'zoomed plot-space window parameters: '//
& 'xmin, ymin, xmax, ymax =', zxmin, zymin, zxmax, zymax
if ( abs(zxmin -(xmin + (xmax-xmin)*0.1d0)) .gt. 1.0d-5 .or.
& abs(zxmax -(xmin+(xmax-xmin)*0.9d0)) .gt. 1.0d-5 .or.
& abs(zymin -(ymin+(ymax-ymin)*0.1d0)) .gt. 1.0d-5 .or.
& abs(zymax -(ymin+(ymax-ymin)*0.9d0)) .gt. 1.0d-5 ) then
write(stderr,*) 'plsdiplz test failed'
status = 1
endif
call plscolbg(10,20,30)
call plgcolbg(r, g, b)
write(*,'(A,3I3)') 'background colour parameters: r, g, b =',
& r, g, b
if (r .ne. 10 .or. g .ne. 20 .or. b .ne. 30) then
write(stderr,*) 'plgcolbg test failed'
status = 1
endif
call plscolbga(20,30,40,0.5d0)
call plgcolbga(r, g, b, a)
write(*,'(A,3I3,F9.6)') 'background/transparency colour '//
& 'parameters: r, g, b, a =', r, g, b, a
if (r.ne.20 .or. g.ne.30 .or. b.ne.40 .or. a.ne.0.5d0) then
write(stderr,*) 'plgcolbga test failed'
status = 1
endif
call plend()
call exit(status)
end
|