~uhh-ssd/+junk/humidity_readout

« back to all changes in this revision

Viewing changes to plplot/plplot-5.9.9/examples/f77/x30f.fm4

  • Committer: Joachim Erfle
  • Date: 2013-07-24 13:53:41 UTC
  • Revision ID: joachim.erfle@desy.de-20130724135341-1qojpp701zsn009p
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
c  $Id: x30f.fm4 11680 2011-03-27 17:57:51Z airwin $
 
2
c
 
3
c   Alpha color values demonstration
 
4
c
 
5
c   Copyright (C) 2008 Hazen Babcock
 
6
c   Copyright (C) 2008 Andrew Ross
 
7
c
 
8
c   This file is part of PLplot.
 
9
c
 
10
c   PLplot is free software; you can redistribute it and/or modify
 
11
c   it under the terms of the GNU Library General Public License as
 
12
c   published by the Free Software Foundation; either version 2 of the
 
13
c   License, or (at your option) any later version.
 
14
c
 
15
c   PLplot is distributed in the hope that it will be useful,
 
16
c   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
17
c   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
18
c   GNU Library General Public License for more details.
 
19
c
 
20
c   You should have received a copy of the GNU Library General Public
 
21
c   License along with PLplot; if not, write to the Free Software
 
22
c   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
23
c
 
24
 
 
25
      program x30f
 
26
 
 
27
      implicit none
 
28
      include 'plplot_parameters.h'
 
29
 
 
30
      integer red(4), green(4), blue(4)
 
31
      real*8 alpha(4), px(4), py(4)
 
32
      real*8 pos(2), rcoord(2), gcoord(2), bcoord(2), acoord(2)
 
33
      logical rev(2)
 
34
 
 
35
      data red   / 0, 255, 0, 0 /
 
36
      data green / 0, 0, 255, 0 /
 
37
      data blue  / 0, 0, 0, 255 /
 
38
      data alpha / 1.0d0, 1.0d0, 1.0d0, 1.0d0 /
 
39
      data px / 0.1d0, 0.5d0, 0.5d0, 0.1d0 /
 
40
      data py / 0.1d0, 0.1d0, 0.5d0, 0.5d0 /
 
41
      data pos / 0.0d0, 1.0d0 / 
 
42
      data rcoord / 1.0d0, 1.0d0 / 
 
43
      data gcoord / 0.0d0, 0.0d0 / 
 
44
      data bcoord / 0.0d0, 0.0d0 / 
 
45
      data acoord / 0.0d0, 1.0d0 /
 
46
      data rev / .false. , .false. /
 
47
 
 
48
      integer i, j
 
49
      integer icol, r, g, b
 
50
      real*8 a
 
51
 
 
52
      character*1 defined
 
53
 
 
54
      call plparseopts(PL_PARSE_FULL)
 
55
 
 
56
      call plinit()
 
57
 
 
58
      call plscmap0n(4)
 
59
 
 
60
      call plscmap0a (red, green, blue, alpha, 4)
 
61
 
 
62
 
63
c     Page 1:
 
64
c
 
65
c     This is a series of red, green and blue rectangles overlaid
 
66
c     on each other with gradually increasing transparency.
 
67
c
 
68
 
 
69
c     Set up the window
 
70
      call pladv (0)
 
71
      call plvpor (0.0d0, 1.0d0, 0.0d0, 1.0d0)
 
72
      call plwind (0.0d0, 1.0d0, 0.0d0, 1.0d0)
 
73
      call plcol0 (0)
 
74
      call plbox ("", 1.0d0, 0, "", 1.0d0, 0)
 
75
 
 
76
c     Draw the boxes 
 
77
      do i = 1,9
 
78
         icol = mod(i-1,3) + 1
 
79
      
 
80
c     Get a color, change its transparency and 
 
81
c     set it as the current color.
 
82
         call plgcol0a (icol, r, g, b, a)
 
83
         call plscol0a (icol, r, g, b, 1.0d0 - dble(i-1)/9.0d0)
 
84
         call plcol0 (icol)
 
85
         
 
86
c     Draw the rectangle
 
87
         call plfill (4, px, py)
 
88
 
 
89
c     Shift the rectangles coordinates
 
90
         do j = 1,4
 
91
            px(j) = px(j) + 0.5d0/9.0d0
 
92
            py(j) = py(j) + 0.5d0/9.0d0
 
93
         enddo
 
94
      enddo
 
95
c
 
96
c     Page 2:
 
97
c
 
98
c     This is a bunch of boxes colored red, green or blue with a single 
 
99
c     large (red) box of linearly varying transparency overlaid. The
 
100
c     overlaid box is completely transparent at the bottom and completely
 
101
c     opaque at the top.
 
102
c     
 
103
 
 
104
c     Set up the window
 
105
      call pladv(0)
 
106
      call plvpor(0.1d0, 0.9d0, 0.1d0, 0.9d0)
 
107
      call plwind(0.0d0, 1.0d0, 0.0d0, 1.0d0)
 
108
 
 
109
c     Draw the boxes. There are 25 of them drawn on a 5 x 5 grid.
 
110
      do i = 1,5
 
111
c     Set box X position
 
112
         px(1) = 0.05d0 + 0.2d0 * dble(i-1)
 
113
         px(2) = px(1) + 0.1d0
 
114
         px(3) = px(2)
 
115
         px(4) = px(1)
 
116
 
 
117
c     We don't want the boxes to be transparent, so since we changed
 
118
c     the colors transparencies in the first example we have to change
 
119
c     the transparencies back to completely opaque.
 
120
         icol = mod(i-1,3) + 1
 
121
         call plgcol0a (icol, r, g, b, a)
 
122
         call plscol0a (icol, r, g, b, 1.0d0)
 
123
         call plcol0 (icol)
 
124
         do j = 1, 5
 
125
c     Set box y position and draw the box.
 
126
            py(1) = 0.05d0 + 0.2d0 * dble(j-1)
 
127
            py(2) = py(1)
 
128
            py(3) = py(1) + 0.1d0
 
129
            py(4) = py(3)
 
130
            call plfill(4, px, py)
 
131
         enddo
 
132
      enddo
 
133
 
 
134
c     Create the color map with 128 colors and call plscmap1la to initialize
 
135
c     the color values with a linearly varying red transparency (or alpha)
 
136
      call plscmap1n(128)
 
137
      call plscmap1la(1, 2, pos, rcoord, gcoord, bcoord, acoord, rev)
 
138
 
 
139
c     Use that cmap1 to create a transparent red gradient for the whole
 
140
c     window.
 
141
      px(1) = 0.d0
 
142
      px(2) = 1.d0
 
143
      px(3) = 1.d0
 
144
      px(4) = 0.d0
 
145
 
 
146
      py(1) = 0.d0
 
147
      py(2) = 0.d0
 
148
      py(3) = 1.d0
 
149
      py(4) = 1.d0
 
150
 
 
151
      call plgradient( 4, px, py, 90.d0 )
 
152
 
 
153
      call plend()
 
154
      end
 
155