From: <and...@us...> - 2008-12-16 14:53:29
|
Revision: 9135 http://plplot.svn.sourceforge.net/plplot/?rev=9135&view=rev Author: andrewross Date: 2008-12-16 14:53:20 +0000 (Tue, 16 Dec 2008) Log Message: ----------- Update java example to reflect recent changes to C examples, including the implementation of example 31. Modified Paths: -------------- trunk/examples/java/CMakeLists.txt trunk/examples/java/x01.java trunk/examples/java/x03.java trunk/examples/java/x09.java trunk/examples/java/x13.java trunk/examples/java/x15.java trunk/examples/java/x29.java trunk/plplot_test/test_java.sh.in Modified: trunk/examples/java/CMakeLists.txt =================================================================== --- trunk/examples/java/CMakeLists.txt 2008-12-16 14:13:49 UTC (rev 9134) +++ trunk/examples/java/CMakeLists.txt 2008-12-16 14:53:20 UTC (rev 9135) @@ -49,6 +49,7 @@ "28" "29" "30" +"31" ) # This information is duplicated from bindings/java/CMakeLists.txt Modified: trunk/examples/java/x01.java =================================================================== --- trunk/examples/java/x01.java 2008-12-16 14:13:49 UTC (rev 9134) +++ trunk/examples/java/x01.java 2008-12-16 14:53:20 UTC (rev 9135) @@ -56,10 +56,7 @@ { // plplot initialization - // Divide page into 2x2 plots unless user overrides. - pls.ssub(2, 2); - // Parse and process command line arguments. // plMergeOpts(options, "x01c options", notes); @@ -73,7 +70,8 @@ System.out.println("PLplot library version: " + version); // Initialize PLplot. - pls.init(); + // Divide page into 2x2 plots unless user overrides. + pls.star(2,2); // Select the multi-stroke font. if (fontset == 1) Modified: trunk/examples/java/x03.java =================================================================== --- trunk/examples/java/x03.java 2008-12-16 14:13:49 UTC (rev 9134) +++ trunk/examples/java/x03.java 2008-12-16 14:53:20 UTC (rev 9135) @@ -65,6 +65,10 @@ pls.parseopts( args, PLStream.PL_PARSE_FULL | PLStream.PL_PARSE_NOPROGRAM ); + // Set orientation to landscape - note not all device drivers + // support this, in particular most interactive drivers do not. + pls.sori(1); + // Initialize plplot. pls.init(); Modified: trunk/examples/java/x09.java =================================================================== --- trunk/examples/java/x09.java 2008-12-16 14:13:49 UTC (rev 9134) +++ trunk/examples/java/x09.java 2008-12-16 14:53:20 UTC (rev 9135) @@ -145,6 +145,7 @@ pls.col0(1); pls.lab("X Coordinate", "Y Coordinate", "Streamlines of flow"); */ + pls.setcontlabelformat(4,3); pls.setcontlabelparam(0.006, 0.3, 0.1, 1); pls.env(-1.0, 1.0, -1.0, 1.0, 0, 0); pls.col0(2); Modified: trunk/examples/java/x13.java =================================================================== --- trunk/examples/java/x13.java 2008-12-16 14:13:49 UTC (rev 9134) +++ trunk/examples/java/x13.java 2008-12-16 14:53:20 UTC (rev 9135) @@ -56,7 +56,12 @@ pls.init(); - pls.env(0., 10., 0., 10., 1, -2); + pls.adv(0); + // Ensure window has aspect ratio of one so circle is + // plotted as a circle. + pls.vasp(1.0); + pls.wind(0., 10., 0., 10.); + //pls.env(0., 10., 0., 10., 1, -2); pls.col0(2); // n.b. all theta quantities scaled by 2*pi/500 to be integers to avoid // floating point logic problems. Modified: trunk/examples/java/x15.java =================================================================== --- trunk/examples/java/x15.java 2008-12-16 14:13:49 UTC (rev 9134) +++ trunk/examples/java/x15.java 2008-12-16 14:53:20 UTC (rev 9135) @@ -115,6 +115,7 @@ plot1( xg0, yg0, z, zmin, zmax ); plot2( xg0, yg0, z, zmin, zmax ); + plot3(); pls.end(); } @@ -165,6 +166,13 @@ int sh_cmap = 0, sh_width; int min_color = 0, min_width = 0, max_color = 0, max_width = 0; int i; + int[] nlin = {1, 1, 1, 1, 1, 2, 2, 2, 2, 2}; + int[][] inc = { {450}, {-450}, {0}, {900}, {300}, + {450,-450}, {0, 900}, {0, 450}, + {450, -450}, {0, 900} }; + int[][] del = { {2000}, {2000}, {2000},{2000}, {2000}, + {2000, 2000}, {2000, 2000}, {2000, 2000}, + {4000, 4000}, {4000, 2000} }; sh_width = 2; pls.adv(0); @@ -177,7 +185,7 @@ shade_min = zmin + (zmax - zmin) * i / 10.0; shade_max = zmin + (zmax - zmin) * (i +1) / 10.0; sh_color = i+6; - pls.psty((i + 2) % 8 + 1); + pls.pat(inc[i],del[i]); pls.shade( z, -1., 1., -1., 1., shade_min, shade_max, @@ -192,6 +200,41 @@ pls.lab("distance", "altitude", "Bogon flux"); } +// Illustrates shaded regions in 3d, using a different fill pattern for +// each region. + + void plot3() + { + double[][] xx = { {-1.0, 1.0, 1.0, -1.0, -1.0}, + {-1.0, 1.0, 1.0, -1.0, -1.0} }; + double[][] yy = { {1.0, 1.0, 0.0, 0.0, 1.0}, + {-1.0, -1.0, 0.0, 0.0, -1.0} }; + double[][] zz = { {0.0, 0.0, 1.0, 1.0, 0.0}, + {0.0, 0.0, 1.0, 1.0, 0.0} }; + + pls.adv(0); + pls.vpor(0.1, 0.9, 0.1, 0.9); + pls.wind(-1.0, 1.0, -1.0, 1.0); + pls.w3d(1., 1., 1., -1.0, 1.0, -1.0, 1.0, 0.0, 1.5, 30, -40); + + // Plot using identity transform + + pls.col0(1); + pls.box3("bntu", "X", 0.0, 0, "bntu", "Y", 0.0, 0, "bcdfntu", "Z", 0.5, 0); + pls.col0(2); + pls.lab("","","3-d polygon filling"); + + pls.col0(3); + pls.psty(1); + pls.line3(xx[0], yy[0], zz[0]); + pls.fill3(xx[0], yy[0], zz[0]); + pls.psty(2); + pls.line3(xx[1], yy[1], zz[1]); + pls.fill3(xx[1], yy[1], zz[1]); + + } + + } //---------------------------------------------------------------------------// Modified: trunk/examples/java/x29.java =================================================================== --- trunk/examples/java/x29.java 2008-12-16 14:13:49 UTC (rev 9134) +++ trunk/examples/java/x29.java 2008-12-16 14:53:20 UTC (rev 9135) @@ -57,6 +57,8 @@ // Initialize plplot pls.init(); + pls.sesc('@'); + plot1(); plot2(); @@ -72,13 +74,17 @@ { int i, npts; double xmin, xmax, ymin, ymax; - double x[], y[]; + double x[], y[], xerr1[], xerr2[], yerr1[], yerr2[]; // Data points every 10 minutes for 1 day - npts = 145; + npts = 73; x = new double[npts]; y = new double[npts]; + xerr1 = new double[npts]; + xerr2 = new double[npts]; + yerr1 = new double[npts]; + yerr2 = new double[npts]; xmin = 0; xmax = 60.0*60.0*24.0; // Number of seconds in a day @@ -88,10 +94,21 @@ for (i=0;i<npts;i++) { x[i] = xmax*((double) i/(double)npts); y[i] = 15.0 - 5.0*Math.cos( 2*Math.PI*((double) i / (double) npts)); + // Set x error bars to +/- 5 minute + xerr1[i] = x[i]-60*5; + xerr2[i] = x[i]+60*5; + // Set y error bars to +/- 0.1 deg C + yerr1[i] = y[i]-0.1; + yerr2[i] = y[i]+0.1; } pls.adv(0); + // Rescale major ticks marks by 0.5 + pls.smaj(0.0,0.5); + // Rescale minor ticks and error bar marks by 0.5 + pls.smin(0.0,0.5); + pls.vsta(); pls.wind(xmin, xmax, ymin, ymax); @@ -102,11 +119,20 @@ pls.box("bcnstd", 3.0*60*60, 3, "bcnstv", 1, 5); pls.col0(3); - pls.lab("Time (hours:mins)", "Temperature (degC)", "#frPLplot Example 29 - Daily temperature"); + pls.lab("Time (hours:mins)", "Temperature (degC)", "@frPLplot Example 29 - Daily temperature"); pls.col0(4); pls.line(x, y); + pls.col0(2); + pls.errx(xerr1, xerr2, y); + pls.col0(3); + pls.erry(x, yerr1, yerr2); + + // Rescale major / minor tick marks back to default + pls.smin(0.0,1.0); + pls.smaj(0.0,1.0); + } // Plot the number of hours of daylight as a function of day for a year @@ -145,16 +171,18 @@ pls.col0(1); // Set time format to be abbreviated month name followed by day of month pls.timefmt("%b %d"); + pls.prec(1,1); pls.env(xmin, xmax, ymin, ymax, 0, 40); pls.col0(3); - pls.lab("Date", "Hours of daylight", "#frPLplot Example 29 - Hours of daylight at 51.5N"); + pls.lab("Date", "Hours of daylight", "@frPLplot Example 29 - Hours of daylight at 51.5N"); pls.col0(4); pls.line(x, y); + pls.prec(0,0); } void plot3() @@ -199,10 +227,11 @@ pls.box("bcnstd", 14*24.0*60.0*60.0,14, "bcnstv", 1, 4); pls.col0(3); - pls.lab("Date", "Hours of television watched", "#frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006"); + pls.lab("Date", "Hours of television watched", "@frPLplot Example 29 - Hours of television watched in Dec 2005 / Jan 2006"); pls.col0(4); - + + pls.ssym(0.0,0.5); pls.poin(x, y, 2); pls.line(x, y); Modified: trunk/plplot_test/test_java.sh.in =================================================================== --- trunk/plplot_test/test_java.sh.in 2008-12-16 14:13:49 UTC (rev 9134) +++ trunk/plplot_test/test_java.sh.in 2008-12-16 14:53:20 UTC (rev 9135) @@ -43,7 +43,7 @@ PLPLOT_CLASSPATH=@JAVADATA_HARDDIR@/plplot.jar fi -for index in 01 02 03 04 05 06 07 08 09 10 11 12 13 15 16 18 20 21 22 23 24 25 26 27 28 29 30; do +for index in 01 02 03 04 05 06 07 08 09 10 11 12 13 15 16 18 20 21 22 23 24 25 26 27 28 29 30 31 ; do if [ "$verbose_test" ]; then echo "x${index}j" fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |