From: <and...@us...> - 2009-08-17 17:51:44
|
Revision: 10271 http://plplot.svn.sourceforge.net/plplot/?rev=10271&view=rev Author: andrewross Date: 2009-08-17 17:51:31 +0000 (Mon, 17 Aug 2009) Log Message: ----------- Update octave bindings to include plarc, plbtime, plctime, plconfigtime, plspal0, plspal1. Update octave examples 3, 16 and 29 to showcase these. Modified Paths: -------------- trunk/bindings/octave/plplot_octave.h.in trunk/examples/octave/x03c.m trunk/examples/octave/x16c.m trunk/examples/octave/x29c.m Modified: trunk/bindings/octave/plplot_octave.h.in =================================================================== --- trunk/bindings/octave/plplot_octave.h.in 2009-08-17 17:07:49 UTC (rev 10270) +++ trunk/bindings/octave/plplot_octave.h.in 2009-08-17 17:51:31 UTC (rev 10271) @@ -424,21 +424,24 @@ #ifndef __PLSTUBS_H__ /* i.e. do not expand this in the stubs */ +#define pl_setcontlabelformat c_pl_setcontlabelformat +#define pl_setcontlabelparam c_pl_setcontlabelparam #define pladv c_pladv -#define plclear c_plclear +#define plarc c_plarc #define plaxes c_plaxes #define plbin c_plbin #define plbop c_plbop #define plbox c_plbox #define plbox3 c_plbox3 +#define plbtime c_plbtime +#define plcalc_world c_plcalc_world +#define plclear c_plclear #define plcol0 c_plcol0 #define plcol1 c_plcol1 -#define plxormod c_plxormod -#define plcalc_world c_plcalc_world +#define plconfigtime c_plconfigtime #define plcont c_plcont #define plcpstrm c_plcpstrm -#define pl_setcontlabelparam c_pl_setcontlabelparam -#define pl_setcontlabelformat c_pl_setcontlabelformat +#define plctime c_plctime #define plend c_plend #define plend1 c_plend1 #define plenv c_plenv @@ -498,7 +501,6 @@ #define plot3d c_plot3d #define plot3dc c_plot3dc #define plparseopts c_plparseopts -#define plsurf3d c_plsurf3d #define plpat c_plpat #define plpoin c_plpoin #define plpoin3 c_plpoin3 @@ -514,10 +516,13 @@ #define plrgbhls c_plrgbhls #define plschr c_plschr #define plscmap0 c_plscmap0 +#define plscmap0a c_plscmap0a +#define plscmap0n c_plscmap0n #define plscmap1 c_plscmap1 -#define plscmap0n c_plscmap0n +#define plscmap1a c_plscmap1a +#define plscmap1l c_plscmap1l +#define plscmap1la c_plscmap1la #define plscmap1n c_plscmap1n -#define plscmap1l c_plscmap1l #define plscol0 c_plscol0 #define plscol0a c_plscol0a #define plscolbg c_plscolbg @@ -525,11 +530,11 @@ #define plscolor c_plscolor #define plscompression c_plscompression #define plsdev c_plsdev -#define plsdiplt c_plsdiplt -#define plsdiplz c_plsdiplz #define plsdidev c_plsdidev #define plsdimap c_plsdimap #define plsdiori c_plsdiori +#define plsdiplt c_plsdiplt +#define plsdiplz c_plsdiplz #define plseed c_plseed #define plsesc c_plsesc #define plsfam c_plsfam @@ -539,10 +544,13 @@ #define plshades c_plshades #define plshade c_plshade #define plshade1 c_plshade1 +#define plslabelfunc c_plslabelfunc #define plsmaj c_plsmaj #define plsmin c_plsmin #define plsori c_plsori #define plspage c_plspage +#define plspal0 c_plspal0 +#define plspal1 c_plspal1 #define plspause c_plspause #define plsstrm c_plsstrm #define plssub c_plssub @@ -553,6 +561,7 @@ #define plstripc c_plstripc #define plstripd c_plstripd #define plstyl c_plstyl +#define plsurf3d c_plsurf3d #define plsvect c_plsvect #define plsvpa c_plsvpa #define plsxax c_plsxax @@ -569,6 +578,7 @@ #define plw3d c_plw3d #define plwid c_plwid #define plwind c_plwind +#define plxormod c_plxormod #endif /* __PLSTUBS_H__ */ @@ -605,6 +615,11 @@ void c_pladv(PLINT page); //%name pladv +/* Plot an arc */ + +void c_plarc(PLFLT x, PLFLT y, PLFLT a, PLFLT b, PLFLT angle1, PLFLT angle2, + PLBOOL fill); //%name plarc + /* This functions similarly to plbox() except that the origin of the axes */ /* is placed at the user-specified point (x0, y0). */ @@ -630,6 +645,12 @@ const char *yopt, const char *ylabel, PLFLT ytick, PLINT nsuby, const char *zopt, const char *zlabel, PLFLT ztick, PLINT nsubz); //%name plbox3 +/* Calculate broken-down time from continuous time for current stream. */ + void c_plbtime(PLINT *year, PLINT *month, PLINT *day, PLINT *hour, PLINT *min, PLFLT *sec, PLFLT ctime); //%name plbtime //%output year, month, day, hour, min, sec + +/* Start new page. Should only be used with pleop(). */ + + /* Set xor mode; 1-enter, 0-leave */ void c_plxormod(PLINT mode, PLINT *status); //%name plxormod //%output status @@ -653,6 +674,10 @@ void c_plcol1(PLFLT col1); //%name plcol1 +/* Configure transformation between continuous and broken-down time (and + vice versa) for current stream. */ + void c_plconfigtime(PLFLT scale, PLFLT offset1, PLFLT offset2, PLINT ccontrol, PLBOOL ifbtime_offset, PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec); //%name plconfigtime + /* Identity transformation. */ void pltr0(PLFLT x, PLFLT y, PLFLT *tx, PLFLT *ty, PLPointer pltr_data); //%nowrap @@ -752,6 +777,9 @@ void c_plcpstrm(PLINT iplsr, PLINT flags); //%name plcpstrm +/* Calculate continuous time from broken-down time for current stream. */ + void c_plctime(PLINT year, PLINT month, PLINT day, PLINT hour, PLINT min, PLFLT sec, PLFLT *ctime); //%name plctime //%output ctime + /* Converts input values from relative device coordinates to relative plot */ /* coordinates. */ @@ -1360,6 +1388,14 @@ void c_plspage(PLFLT xp, PLFLT yp, PLINT xleng, PLINT yleng, PLINT xoff, PLINT yoff); //%name plspage +/* Set the colors for color table 0 from a cmap0 file */ + + void c_plspal0(const char *filename); //%name plspal0 + +/* Set the colors for color table 1 from a cmap1 file */ + +void c_plspal1(const char *filename); //%name plspal1 + /* Set the pause (on end-of-page) status */ void c_plspause(PLINT pause); //%name plspause Modified: trunk/examples/octave/x03c.m =================================================================== --- trunk/examples/octave/x03c.m 2009-08-17 17:07:49 UTC (rev 10270) +++ trunk/examples/octave/x03c.m 2009-08-17 17:51:31 UTC (rev 10271) @@ -46,13 +46,11 @@ ## Set up viewport and window, but do not draw box */ plenv(-1.3, 1.3, -1.3, 1.3, 1, -2); - for i=1:10 - x(:) = 0.1 * i * x0(:); - y(:) = 0.1 * i * y0(:); - - ## Draw circles for polar grid */ - plline(x', y'); - endfor + ## Draw circles for polar grid + for i=1:10 + plarc(0.0, 0.0, 0.1 * i, 0.1 * i, 0.0, 360.0, 0); + endfor + plcol0(2); for i=0:11 Modified: trunk/examples/octave/x16c.m =================================================================== --- trunk/examples/octave/x16c.m 2009-08-17 17:07:49 UTC (rev 10270) +++ trunk/examples/octave/x16c.m 2009-08-17 17:51:31 UTC (rev 10271) @@ -60,6 +60,9 @@ ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display + ## Load colour palettes + plspal0("cmap0_black_on_white.pal"); + plspal1("cmap1_gray.pal"); plscmap0n(3); ## Initialize plplot @@ -126,6 +129,12 @@ ## Plot using 1d coordinate transform + ## Load colour palettes + plspal0("cmap0_black_on_white.pal"); + plspal1("cmap1_blue_yellow.pal"); + ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display + plscmap0n(3); + pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); @@ -146,6 +155,12 @@ ## Plot using 2d coordinate transform + ## Load colour palettes + plspal0("cmap0_black_on_white.pal"); + plspal1("cmap1_blue_red.pal"); + ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display + plscmap0n(3); + pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); @@ -165,6 +180,12 @@ ## Plot using 2d coordinate transform + ## Load colour palettes + plspal0(""); + plspal1(""); + ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display + plscmap0n(3); + pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); @@ -186,6 +207,12 @@ ## Plot using 2d coordinate transform and exclusion if (0) ## exclusion not implemented + ## Load colour palettes + plspal0("cmap0_black_on_white.pal"); + plspal1("cmap1_gray.pal"); + ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display + plscmap0n(3); + pladv(0); plvpor(0.1, 0.9, 0.1, 0.9); plwind(-1.0, 1.0, -1.0, 1.0); @@ -204,6 +231,12 @@ ### Example with polar coordinates. PERIMETERPTS=100; + ## Load colour palettes + plspal0("cmap0_black_on_white.pal"); + plspal1("cmap1_gray.pal"); + ## Reduce colors in cmap 0 so that cmap 1 is useful on a 16-color display + plscmap0n(3); + pladv(0); plvpor( .1, .9, .1, .9 ); plwind( -1., 1., -1., 1. ); Modified: trunk/examples/octave/x29c.m =================================================================== --- trunk/examples/octave/x29c.m 2009-08-17 17:07:49 UTC (rev 10270) +++ trunk/examples/octave/x29c.m 2009-08-17 17:51:31 UTC (rev 10271) @@ -41,6 +41,8 @@ plot2(); plot3(); + + plot4(); ## Clean up plend1(); @@ -199,6 +201,118 @@ plline(x', y'); endfunction + +function plot4 + + ## TAI-UTC (seconds) as a function of time. + ## Use Besselian epochs as the continuous time interval just to prove + ## this does not introduce any issues. + ## Use the definition given in http://en.wikipedia.org/wiki/Besselian_epoch + ## B = 1900. + (JD -2415020.31352)/365.242198781 + ## ==> (as calculated with aid of "bc -l" command) + ## B = (MJD + 678940.364163900)/365.242198781 + ## ==> + ## MJD = B*365.24219878 - 678940.364163900 + scale = 365.242198781; + offset1 = -678940.; + offset2 = -0.3641639; + plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.); + + for kind=0:6 + if (kind == 0) + xmin = plctime(1950,0,2,0,0,0.); + xmax = plctime(2020,0,2,0,0,0.); + npts = 70*12 + 1; + ymin = 0.0; + ymax = 36.0; + time_format = "%Y%"; + if_TAI_time_format = 1; + title_suffix = "from 1950 to 2020"; + xtitle = "Year"; + xlabel_step = 10.; + elseif (kind == 1 || kind ==2) + xmin = plctime(1961,7,1,0,0,1.64757-.20); + xmax = plctime(1961,7,1,0,0,1.64757+.20); + npts = 1001; + ymin = 1.625; + ymax = 1.725; + time_format = "%S%2%"; + title_suffix = "near 1961-08-01 (TAI)"; + xlabel_step = 0.05/(scale*86400.); + if (kind == 1) + if_TAI_time_format = 1; + xtitle = "Seconds (TAI)"; + else + if_TAI_time_format = 0; + xtitle = "Seconds (TAI) labelled with corresponding UTC"; + endif + elseif (kind == 3 || kind ==4) + xmin = plctime(1963,10,1,0,0,2.6972788-.20); + xmax = plctime(1963,10,1,0,0,2.6972788+.20); + npts = 1001; + ymin = 2.55; + ymax = 2.75; + time_format = "%S%2%"; + title_suffix = "near 1963-11-01 (TAI)"; + xlabel_step = 0.05/(scale*86400.); + if (kind == 3) + if_TAI_time_format = 1; + xtitle = "Seconds (TAI)"; + else + if_TAI_time_format = 0; + xtitle = "Seconds (TAI) labelled with corresponding UTC"; + endif + elseif (kind == 5 || kind == 6) + xmin = plctime(2009,0,1,0,0,34.-5.); + xmax = plctime(2009,0,1,0,0,34.+5.); + npts = 1001; + ymin = 32.5; + ymax = 34.5; + time_format = "%S%2%"; + title_suffix = "near 2009-01-01 (TAI)"; + xlabel_step = 1./(scale*86400.); + if (kind == 5) + if_TAI_time_format = 1; + xtitle = "Seconds (TAI)"; + else + if_TAI_time_format = 0; + xtitle = "Seconds (TAI) labelled with corresponding UTC"; + endif + endif + + x = xmin + (0:npts-1)*(xmax-xmin)/(npts-1); + utc = zeros(npts,1); + plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.); + tai = x; + [tai_year, tai_month, tai_day, tai_hour, tai_min, tai_sec] = plbtime(tai); + plconfigtime(scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0.); + [utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec] = plbtime(tai); + plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.); + utc = plctime(utc_year, utc_month, utc_day, utc_hour, utc_min, utc_sec); + y = (tai-utc)*scale*86400.0; + + pladv(0); + plvsta(); + plwind(xmin, xmax, ymin, ymax); + plcol0(1); + if (if_TAI_time_format) + plconfigtime(scale, offset1, offset2, 0x0, 0, 0, 0, 0, 0, 0, 0.); + else + plconfigtime(scale, offset1, offset2, 0x2, 0, 0, 0, 0, 0, 0, 0.); + endif + pltimefmt(time_format); + plbox("bcnstd", xlabel_step, 0, "bcnstv", 0., 0); + plcol0(3); + title = strcat("@frPLplot Example 29 - TAI-UTC ", title_suffix); + pllab(xtitle, "TAI-UTC (sec)", title); + + plcol0(4); + + plline(x', y'); + endfor +endfunction + + ix29c This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |