~uhh-ssd/+junk/humidity_readout

« back to all changes in this revision

Viewing changes to plplot/plplot-5.9.9/examples/f95/x13f.f90

  • 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
!      $Id: x13f.f90 11680 2011-03-27 17:57:51Z airwin $
 
2
!      Pie chart demo.
 
3
!
 
4
!      Copyright (C) 2004  Alan W. Irwin
 
5
!
 
6
!      This file is part of PLplot.
 
7
!
 
8
!      PLplot is free software; you can redistribute it and/or modify
 
9
!      it under the terms of the GNU Library General Public License as
 
10
!      published by the Free Software Foundation; either version 2 of the
 
11
!      License, or (at your option) any later version.
 
12
!
 
13
!      PLplot is distributed in the hope that it will be useful,
 
14
!      but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
!      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
16
!      GNU Library General Public License for more details.
 
17
!
 
18
!      You should have received a copy of the GNU Library General Public
 
19
!      License along with PLplot; if not, write to the Free Software
 
20
!      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
21
 
 
22
      use plplot, PI => PL_PI
 
23
      implicit none
 
24
      real(kind=plflt) just, dx, dy, x(500), y(500), per(5)
 
25
      integer i, j, dthet, theta0, theta1, theta
 
26
      character*20 text(5)
 
27
      data text / 'Maurice', 'Geoffrey', 'Alan', 'Rafael', 'Vince'/
 
28
 
 
29
!      Process command-line arguments
 
30
      call plparseopts(PL_PARSE_FULL)
 
31
 
 
32
      per(1) = 10._plflt
 
33
      per(2) = 32._plflt
 
34
      per(3) = 12._plflt
 
35
      per(4) = 30._plflt
 
36
      per(5) = 16._plflt
 
37
 
 
38
!      Ask user to specify the output device.
 
39
 
 
40
      call plinit()
 
41
 
 
42
      call pladv(0)
 
43
!     Ensure window has aspect ratio of one so circle is
 
44
!     plotted as a circle.
 
45
      call plvasp(1.0_plflt)
 
46
      call plwind(0._plflt, 10._plflt, 0._plflt, 10._plflt)      
 
47
!      call plenv( 0._plflt, 10._plflt, 0._plflt, 10._plflt, 1, -2 )
 
48
      call plcol0(2)
 
49
 
 
50
!      n.b. all theta quantities scaled by 2*pi/500 to be integers to avoid
 
51
!      floating point logic problems.
 
52
      theta0 = 0
 
53
      dthet = 1
 
54
 
 
55
      do i = 0, 4
 
56
        j = 0
 
57
        x(j+1) = 5._plflt
 
58
        y(j+1) = 5._plflt
 
59
        j = j + 1
 
60
!        n.b. the theta quantities multiplied by 2*pi/500 afterward so
 
61
!        in fact per is interpreted as a percentage.
 
62
        theta1 = theta0 + 5*per(i+1)
 
63
        if (i .eq. 4) theta1 = 500
 
64
        do theta = theta0, theta1, dthet
 
65
          x(j+1) = 5 + 3*cos((2._plflt*pi/500._plflt)*theta)
 
66
          y(j+1) = 5 + 3*sin((2._plflt*pi/500._plflt)*theta)
 
67
          j = j + 1
 
68
        enddo
 
69
 
 
70
        call plcol0(i+1)
 
71
        call plpsty( mod(i+3, 8) + 1 )
 
72
        call plfill(x(:j), y(:j))
 
73
        call plcol0(1)
 
74
        call plline(x(:j), y(:j))
 
75
 
 
76
        just = (2._plflt*pi/500._plflt)*(theta0 + theta1) / 2._plflt
 
77
        dx = 0.25_plflt * cos(just)
 
78
        dy = 0.25_plflt * sin(just)
 
79
        if ((theta0  + theta1) .lt. 250 .or. &
 
80
            (theta0 + theta1) .gt. 750) then
 
81
          just = 0._plflt
 
82
        else
 
83
          just = 1._plflt
 
84
        endif
 
85
        call plptex( x(j/2+1)+dx, y(j/2+1)+dy, 1._plflt, 0._plflt, &
 
86
          just, text(i+1) )
 
87
        theta0 = theta - dthet
 
88
      enddo
 
89
 
 
90
      call plfont(2)
 
91
      call plschr( 0._plflt, 1.3_plflt)
 
92
      call plptex( 5._plflt, 9._plflt, 1._plflt, 0._plflt, &
 
93
        0.5_plflt, 'Percentage of Sales' )
 
94
 
 
95
      call plend
 
96
      end