~ubuntu-branches/ubuntu/intrepid/plplot/intrepid

« back to all changes in this revision

Viewing changes to examples/java/x04.java

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2006-11-04 10:19:34 UTC
  • mfrom: (2.1.8 edgy)
  • Revision ID: james.westby@ubuntu.com-20061104101934-mlirvdg4gpwi6i5q
Tags: 5.6.1-10
* Orphaning the package
* debian/control: Changed the maintainer to the Debian QA Group

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
//---------------------------------------------------------------------------//
2
 
// $Id: x04.java,v 1.8 2004/01/17 16:41:39 rlaboiss Exp $
 
2
// $Id: x04.java,v 1.14 2005/07/03 12:43:39 andrewross Exp $
3
3
//---------------------------------------------------------------------------//
4
4
 
5
5
//---------------------------------------------------------------------------//
6
6
// Copyright (C) 2001  Geoffrey Furnish
7
7
// Copyright (C) 2001, 2002  Alan W. Irwin
 
8
// Copyright (C) 2004  Andrew Ross
8
9
//
9
10
// This file is part of PLplot.
10
11
//
19
20
//
20
21
// You should have received a copy of the GNU Library General Public License
21
22
// along with PLplot; if not, write to the Free Software
22
 
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 
23
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
23
24
//---------------------------------------------------------------------------//
24
25
 
25
26
//---------------------------------------------------------------------------//
34
35
 
35
36
class x04 {
36
37
 
37
 
   PLStreamc plsdummy = new PLStreamc();
38
 
   plplotjavac pls = new plplotjavac();
 
38
    PLStream pls = new PLStream();
39
39
 
40
40
    public static void main( String[] args ) 
41
41
    {
46
46
    {
47
47
    // Parse and process command line arguments.
48
48
 
49
 
        pls.plParseOpts( args, pls.PL_PARSE_FULL | pls.PL_PARSE_NOPROGRAM );
 
49
        pls.parseopts( args, PLStream.PL_PARSE_FULL | PLStream.PL_PARSE_NOPROGRAM );
50
50
 
51
51
    // Initialize plplot.
52
52
 
53
 
        pls.plinit();
54
 
        pls.plfont(2);
 
53
        pls.init();
 
54
        pls.font(2);
55
55
 
56
56
    // Make log plots using two different styles.
57
57
 
58
58
        plot1(0);
59
59
        plot1(1);
60
60
 
61
 
        pls.plend();
 
61
        pls.end();
62
62
    }
63
63
 
64
64
// Log-linear plot.
71
71
        double[] phase = new double[101];
72
72
        double f0, freq;
73
73
 
74
 
        pls.pladv(0);
 
74
        pls.adv(0);
75
75
 
76
76
    // Set up data for log plot.
77
77
 
84
84
            phase[i] = -(180.0 / Math.PI) * Math.atan(freq / f0);
85
85
        }
86
86
 
87
 
        pls.plvpor(0.15, 0.85, 0.1, 0.9);
88
 
        pls.plwind(-2.0, 3.0, -80.0, 0.0);
 
87
        pls.vpor(0.15, 0.85, 0.1, 0.9);
 
88
        pls.wind(-2.0, 3.0, -80.0, 0.0);
89
89
 
90
90
    // Try different axis and labelling styles.
91
91
 
92
 
        pls.plcol0(1);
 
92
        pls.col0(1);
93
93
        switch (type) {
94
94
        case 0:
95
 
            pls.plbox("bclnst", 0.0, 0, "bnstv", 0.0, 0);
 
95
            pls.box("bclnst", 0.0, 0, "bnstv", 0.0, 0);
96
96
            break;
97
97
        case 1:
98
 
            pls.plbox("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0);
 
98
            pls.box("bcfghlnst", 0.0, 0, "bcghnstv", 0.0, 0);
99
99
            break;
100
100
        }
101
101
 
102
102
    // Plot ampl vs freq.
103
103
 
104
 
        pls.plcol0(2);
105
 
        pls.plline(freql, ampl);
106
 
        pls.plcol0(1);
107
 
        pls.plptex(1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade");
 
104
        pls.col0(2);
 
105
        pls.line(freql, ampl);
 
106
        pls.col0(1);
 
107
        pls.ptex(1.6, -30.0, 1.0, -20.0, 0.5, "-20 dB/decade");
108
108
 
109
109
    // Put labels on.
110
110
 
111
 
        pls.plcol0(1);
112
 
        pls.plmtex("b", 3.2, 0.5, 0.5, "Frequency");
113
 
        pls.plmtex("t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter");
114
 
        pls.plcol0(2);
115
 
        pls.plmtex("l", 5.0, 0.5, 0.5, "Amplitude (dB)");
 
111
        pls.col0(1);
 
112
        pls.mtex("b", 3.2, 0.5, 0.5, "Frequency");
 
113
        pls.mtex("t", 2.0, 0.5, 0.5, "Single Pole Low-Pass Filter");
 
114
        pls.col0(2);
 
115
        pls.mtex("l", 5.0, 0.5, 0.5, "Amplitude (dB)");
116
116
 
117
117
    // For the gridless case, put phase vs freq on same plot.
118
118
 
119
119
        if (type == 0) {
120
 
            pls.plcol0(1);
121
 
            pls.plwind(-2.0, 3.0, -100.0, 0.0);
122
 
            pls.plbox("", 0.0, 0, "cmstv", 30.0, 3);
123
 
            pls.plcol0(3);
124
 
            pls.plline(freql, phase);
125
 
            pls.plcol0(3);
126
 
            pls.plmtex("r", 5.0, 0.5, 0.5, "Phase shift (degrees)");
 
120
            pls.col0(1);
 
121
            pls.wind(-2.0, 3.0, -100.0, 0.0);
 
122
            pls.box("", 0.0, 0, "cmstv", 30.0, 3);
 
123
            pls.col0(3);
 
124
            pls.line(freql, phase);
 
125
            pls.col0(3);
 
126
            pls.mtex("r", 5.0, 0.5, 0.5, "Phase shift (degrees)");
127
127
        }
128
128
    }
129
129
}