From: <and...@us...> - 2010-07-26 19:34:26
|
Revision: 11108 http://plplot.svn.sourceforge.net/plplot/?rev=11108&view=rev Author: andrewross Date: 2010-07-26 19:34:19 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Fix recently introduced problems with octave shade function. Also upgrade to allow use of 2-d arrays for x and y coordinates (as with matlab contourf function). Fix problem in example p17 which causes a division by zero error when plimage is called with min and max values set to the same. Switch from using loadimage to imread for example p17 which removes obsolete function warning. Re-enable all p examples in octave interactive script as they should now work again. Modified Paths: -------------- trunk/bindings/octave/PLplot/shade.m trunk/examples/octave/p17.m trunk/plplot_test/test_octave_interactive.sh.in Modified: trunk/bindings/octave/PLplot/shade.m =================================================================== --- trunk/bindings/octave/PLplot/shade.m 2010-07-24 17:11:07 UTC (rev 11107) +++ trunk/bindings/octave/PLplot/shade.m 2010-07-26 19:34:19 UTC (rev 11108) @@ -52,6 +52,12 @@ levels = 2; endif + if (rows(x) > 1 & columns(x) > 1 & rows(y) > 1 & columns(y) > 1) + xymat = 1; + else + xymat = 0; + endif + ## plot color and pen width of boundary of shade region max_color = 0; max_width = 0; @@ -62,8 +68,6 @@ cont_color = 0; cont_width = 0; endif - xlen = length (x); ylen = length (y); - if (ishold == 0) xmm = xm = min(min(x)); xM = max(max(x)); ymm = ym = min(min(y)); yM = max(max(y)); @@ -71,17 +75,19 @@ if (__pl.axis_st(strm)) xm = __pl.axis(strm,1); xM = __pl.axis(strm,2); - ix = find(x >= xm & x <= xM); - x=x(ix); z=z(:,ix); - xlen = length (x); - xmm = min(x); + if (xymat == 0) + ix = find(x >= xm & x <= xM); + x=x(ix); z=z(:,ix); + xmm = min(x); + endif if (length(__pl.axis(strm,:)) >= 4) ym = __pl.axis(strm,3); yM = __pl.axis(strm,4); - iy = find(y >= ym & y <= yM); - y=y(iy); z=z(iy,:); - ylen = length (y); - ymm = min(y); + if (xymat == 0) + iy = find(y >= ym & y <= yM); + y=y(iy); z=z(iy,:); + ymm = min(y); + endif else __pl.axis(strm,3) = ym; __pl.axis(strm,4) = yM; endif @@ -106,10 +112,22 @@ xmm = xm = __pl.axis(strm,1); xM = __pl.axis(strm,2); ymm = ym = __pl.axis(strm,3); yM = __pl.axis(strm,4); zm = __pl.axis(strm,5); zM = __pl.axis(strm,6); - z = z( find(y >= ym & y <= yM), find(x >= xm & x <= xM)); + if (xymat == 0) + ix = find(x >= xm & x <= xM); + iy = find(y >= ym & y <= yM); + z = z( iy, ix ); + x = x( ix ); + y = y( iy ); + endif endif - maxx = max(x); maxy = max(y); minx = min(x); miny = min(y); + maxx = max(max(x)); maxy = max(max(y)); minx = min(min(x)); miny = min(min(y)); + if (columns(x)>1 & rows(x) == 1) + x = x'; + endif + if (columns(y)>1 & rows(y) == 1) + y = y'; + endif if (!isscalar(levels)) n = length(levels)-1; @@ -128,7 +146,7 @@ __pl.lab_pos(strm) = 1; plpsty(0); - if (1) ## plshades() is slower than several calls to plshade() !? and plshades() sometimes fails ?! + if (0) ## plshades() is slower than several calls to plshade() !? and plshades() sometimes fails ?! for i = 1:n plshade1(z', 0, minx, maxx, miny, maxy, clevel(i), clevel(i+1), @@ -136,9 +154,13 @@ cont_color, cont_width, max_color, max_width, 1, x, y); endfor else - - plshadesx(z, minx, maxx, miny, maxy, + if (columns(x) == 1 & columns(y) == 1) + plshades1(z', minx, maxx, miny, maxy, clevel', 1, cont_color, cont_width, 1, x, y); + else + plshades2(z', minx, maxx, miny, maxy, + clevel', 1, cont_color, cont_width, 1, x', y'); + endif endif for i = 1:n @@ -161,7 +183,7 @@ endif if (__pl.legend(strm)) - __pl_draw_legend + __pl_draw_legend; endif plcol(15); Modified: trunk/examples/octave/p17.m =================================================================== --- trunk/examples/octave/p17.m 2010-07-24 17:11:07 UTC (rev 11107) +++ trunk/examples/octave/p17.m 2010-07-26 19:34:19 UTC (rev 11108) @@ -21,11 +21,18 @@ title "Click and Drag button 1 to select"; xlabel "Button 2 to restart and button 3 to finish"; ylabel ""; - [img, map]= loadimage (file_in_loadpath ("lena.img")); + [img, map]= imread (file_in_loadpath ("lena.img")); colormap(map); plimage (img); if (!nargin) [x1, y1, x2, y2] = plrb(1); + % Prevent case where range is zero + if (x1 == x2) + x2 = x1+1; + end + if (y1 == y2) + y2 = y1+1; + end title "Lena"; xlabel ""; plimage (img, x1, x2, y1, y2); Modified: trunk/plplot_test/test_octave_interactive.sh.in =================================================================== --- trunk/plplot_test/test_octave_interactive.sh.in 2010-07-24 17:11:07 UTC (rev 11107) +++ trunk/plplot_test/test_octave_interactive.sh.in 2010-07-26 19:34:19 UTC (rev 11108) @@ -74,7 +74,7 @@ # Remove 17 until an additional fix is done. # Remove combined example 21. plsetopt("dev","$device"); -for i=[1:6 8:15 18:19]; +for i=[1:20]; if (verbose_test) printf("p%d\n",i); endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |