From: <and...@us...> - 2008-12-15 12:45:27
|
Revision: 9117 http://plplot.svn.sourceforge.net/plplot/?rev=9117&view=rev Author: andrewross Date: 2008-12-15 12:45:13 +0000 (Mon, 15 Dec 2008) Log Message: ----------- Update examples 9, 15 and 29 to include examples of using the following common API functions : pl_setcontlabelformat, plpat, plsmaj, plsmin, plerrx, plerry, plprec, plssym. This has already shown up one bug in plerrx and plerry. Currently only C versions have been updated. Modified Paths: -------------- trunk/doc/docbook/src/api.xml trunk/examples/c/x09c.c trunk/examples/c/x15c.c trunk/examples/c/x29c.c Modified: trunk/doc/docbook/src/api.xml =================================================================== --- trunk/doc/docbook/src/api.xml 2008-12-15 12:40:45 UTC (rev 9116) +++ trunk/doc/docbook/src/api.xml 2008-12-15 12:45:13 UTC (rev 9117) @@ -201,7 +201,7 @@ </para> <para> - This function is not used in any examples. + This function is used example 9. </para> </sect1> @@ -2779,7 +2779,7 @@ </para> <para> - This function is not used in any examples. + This function is used in example 29. </para> </sect1> @@ -2886,7 +2886,7 @@ </para> <para> - This function is not used in any examples. + This function is used in example 29. </para> </sect1> @@ -7743,7 +7743,7 @@ </para> <para> - This function is not used in any examples. + This function is used in example 15. </para> </sect1> @@ -8140,7 +8140,7 @@ </para> <para> - This function is not used in any examples. + This function is used in example 29. </para> </sect1> @@ -11839,7 +11839,7 @@ </para> <para> - This function is not used in any examples. + This function is used in example 29. </para> </sect1> @@ -11976,7 +11976,7 @@ </para> <para> - This function is not used in any examples. + This function is used in example 29. </para> </sect1> @@ -12344,7 +12344,7 @@ </para> <para> - This function is not used in any examples. + This function is used in example 29. </para> </sect1> Modified: trunk/examples/c/x09c.c =================================================================== --- trunk/examples/c/x09c.c 2008-12-15 12:40:45 UTC (rev 9116) +++ trunk/examples/c/x09c.c 2008-12-15 12:45:13 UTC (rev 9117) @@ -346,6 +346,7 @@ plcol0(1); pllab("X Coordinate", "Y Coordinate", "Streamlines of flow"); */ + pl_setcontlabelformat(4,3); pl_setcontlabelparam(0.006, 0.3, 0.1, 1); plenv(-1.0, 1.0, -1.0, 1.0, 0, 0); plcol0(2); Modified: trunk/examples/c/x15c.c =================================================================== --- trunk/examples/c/x15c.c 2008-12-15 12:40:45 UTC (rev 9116) +++ trunk/examples/c/x15c.c 2008-12-15 12:45:13 UTC (rev 9117) @@ -22,6 +22,14 @@ static void cmap1_init1 (void); static void cmap1_init2 (void); +static PLINT nlin[10] = {1, 1, 1, 1, 1, 2, 2, 2, 2, 2}; +static PLINT inc[10][2] = { {450, 0}, {-450, 0}, {0, 0}, {900, 0}, {300, 0}, + {450,-450}, {0, 900}, {0, 450}, {450, -450}, {0, 900} }; +static PLINT del[10][2] = { {2000, 2000}, {2000, 2000}, {2000, 2000}, + {2000, 2000}, {2000, 2000}, {2000, 2000}, + {2000, 2000}, {2000, 2000}, {4000, 4000}, + {4000, 2000} }; + /*--------------------------------------------------------------------------*\ * main * @@ -218,7 +226,7 @@ shade_min = zmin + (zmax - zmin) * i / 10.0; shade_max = zmin + (zmax - zmin) * (i +1) / 10.0; sh_color = i+6; - plpsty((i + 2) % 8 + 1); + plpat(nlin[i],inc[i],del[i]); plshade1(&z[0][0], XPTS, YPTS, NULL, -1., 1., -1., 1., shade_min, shade_max, Modified: trunk/examples/c/x29c.c =================================================================== --- trunk/examples/c/x29c.c 2008-12-15 12:40:45 UTC (rev 9116) +++ trunk/examples/c/x29c.c 2008-12-15 12:45:13 UTC (rev 9117) @@ -27,6 +27,7 @@ #include <time.h> static PLFLT x[365], y[365]; +static PLFLT xerr1[365], xerr2[365], yerr1[365], yerr2[365]; /* Function prototypes */ @@ -78,7 +79,7 @@ PLFLT xmin, xmax, ymin, ymax; /* Data points every 10 minutes for 1 day */ - npts = 145; + npts = 73; xmin = 0; xmax = 60.0*60.0*24.0; /* Number of seconds in a day */ @@ -88,10 +89,21 @@ for (i=0;i<npts;i++) { x[i] = xmax*((PLFLT) i/(PLFLT)npts); y[i] = 15.0 - 5.0*cos( 2*M_PI*((PLFLT) i / (PLFLT) 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; } pladv(0); + /* Rescale major ticks marks by 0.5 */ + plsmaj(0,0.5); + /* Rescale minor ticks and error bar marks by 0.5 */ + plsmin(0,0.5); + plvsta(); plwind(xmin, xmax, ymin, ymax); @@ -107,6 +119,15 @@ plcol0(4); plline(npts, x, y); + plcol0(2); + plerrx(npts, xerr1, xerr2, y); + plcol0(3); + plerry(npts, x, yerr1, yerr2); + + /* Rescale major / minor tick marks back to default */ + plsmin(0,1.0); + plsmaj(0,1.0); + } /* Plot the number of hours of daylight as a function of day for a year */ @@ -142,6 +163,7 @@ plcol0(1); /* Set time format to be abbreviated month name followed by day of month */ pltimefmt("%b %d"); + plprec(1,1); plenv(xmin, xmax, ymin, ymax, 0, 40); @@ -152,6 +174,7 @@ plline(npts, x, y); + plprec(0,0); } void @@ -220,6 +243,8 @@ plcol0(4); + /* Rescale symbol size (used by plpoin) by 0.5 */ + plssym(0.0,0.5); plpoin(npts, x, y, 2); plline(npts, x, y); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |