# HG changeset patch # User Rik # Date 1259952298 28800 # Node ID e76d8c767584099dc272a956c710f86cc2209165 # Parent 5cd48568ec591027e84571371b5734805cd9f26c Switch to color output for PostScript documentation images diff -r 5cd48568ec59 -r e76d8c767584 doc/ChangeLog --- a/doc/ChangeLog Fri Dec 04 12:55:41 2009 -0500 +++ b/doc/ChangeLog Fri Dec 04 10:44:58 2009 -0800 @@ -1,3 +1,9 @@ +2009-12-04 Rik + + * interpreter/geometryimages.m, interpreter/interpimages.m, + interpreter/sparseimages.m, interpreter/plotimages.m: + Switch to color output for PostScript documentation images + 2009-12-04 Rik * interpreter/geometryimages.m, interpreter/interpimages.m, diff -r 5cd48568ec59 -r e76d8c767584 doc/interpreter/geometryimages.m --- a/doc/interpreter/geometryimages.m Fri Dec 04 12:55:41 2009 -0500 +++ b/doc/interpreter/geometryimages.m Fri Dec 04 10:44:58 2009 -0800 @@ -22,6 +22,11 @@ if (strcmp (typ, "png")) set (0, "defaulttextfontname", "*"); endif + if (strcmp (typ, "eps")) + d_typ = "-depsc2"; + else + d_typ = cstrcat ("-d", typ); + endif if (isempty (findstr (octave_config_info ("DEFS"), "HAVE_QHULL")) && (strcmp (nm, "voronoi") || strcmp (nm, "griddata") @@ -46,14 +51,14 @@ plot (xc, yc, "g-", "LineWidth", 3); axis([0, 1, 0, 1]); legend ("Delaunay Triangulation", "Voronoi Diagram"); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "triplot")) rand ("state", 2) x = rand (20, 1); y = rand (20, 1); tri = delaunay (x, y); triplot (tri, x, y); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "griddata")) rand("state",1); x=2*rand(1000,1)-1; @@ -61,14 +66,14 @@ z=sin(2*(x.^2+y.^2)); [xx,yy]=meshgrid(linspace(-1,1,32)); griddata(x,y,z,xx,yy); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "convhull")) x = -3:0.05:3; y = abs (sin (x)); k = convhull (x, y); plot (x(k),y(k),'r-',x,y,'b+'); axis ([-3.05, 3.05, -0.05, 1.05]); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "delaunay")) rand ("state", 1); x = rand (1, 10); @@ -78,7 +83,7 @@ Y = [ y(T(:,1)); y(T(:,2)); y(T(:,3)); y(T(:,1)) ]; axis ([0, 1, 0, 1]); plot(X, Y, "b", x, y, "r*"); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "inpolygon")) randn ("state", 2); x = randn (100, 1); @@ -88,7 +93,7 @@ in = inpolygon (x, y, vx, vy); plot(vx, vy, x(in), y(in), "r+", x(!in), y(!in), "bo"); axis ([-2, 2, -2, 2]); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) else error ("unrecognized plot requested"); endif @@ -144,7 +149,7 @@ mesh (x, y, z); title ("Sorry, graphics not available because octave was\\ncompiled without the QHULL library."); unwind_protect_cleanup - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)); + print (cstrcat (nm, ".", typ), d_typ); hide_output (); end_unwind_protect endif diff -r 5cd48568ec59 -r e76d8c767584 doc/interpreter/interpimages.m --- a/doc/interpreter/interpimages.m Fri Dec 04 12:55:41 2009 -0500 +++ b/doc/interpreter/interpimages.m Fri Dec 04 10:44:58 2009 -0800 @@ -22,6 +22,11 @@ if (strcmp (typ, "png")) set (0, "defaulttextfontname", "*"); endif + if (strcmp (typ, "eps")) + d_typ = "-depsc2"; + else + d_typ = cstrcat ("-d", typ); + endif if (strcmp (typ, "txt")) image_as_txt (nm); @@ -34,7 +39,7 @@ plot (ti, yp, 'g', ti, interp1(t, y, ti, 'spline'), 'b', ... ti, interpft (y, k), 'c', t, y, 'r+'); legend ('sin(4t+0.3)cos(3t-0.1)','spline','interpft','data'); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "interpn")) x = y = z = -1:1; f = @(x,y,z) x.^2 - y - z.^2; @@ -44,7 +49,7 @@ [xxi, yyi, zzi] = ndgrid (xi, yi, zi); vi = interpn(x, y, z, v, xxi, yyi, zzi, 'spline'); mesh (zi, yi, squeeze (vi(1,:,:))); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "interpderiv1")) t = -2:2; dt = 1; @@ -55,7 +60,7 @@ yp = interp1(t,y,ti,'pchip'); plot (ti, ys,'r-', ti, yp,'g-'); legend('spline','pchip', 4); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "interpderiv2")) t = -2:2; dt = 1; @@ -66,7 +71,7 @@ ddyp = diff(diff(interp1(t,y,ti,'pchip'))./dti)./dti; plot (ti(2:end-1),ddys,'r*', ti(2:end-1),ddyp,'g+'); legend('spline','pchip'); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) endif hide_output (); endfunction diff -r 5cd48568ec59 -r e76d8c767584 doc/interpreter/plotimages.m --- a/doc/interpreter/plotimages.m Fri Dec 04 12:55:41 2009 -0500 +++ b/doc/interpreter/plotimages.m Fri Dec 04 10:44:58 2009 -0800 @@ -19,21 +19,25 @@ function plotimages (nm, typ) set_print_size (); hide_output (); - if (strcmp (typ, "png")) set (0, "defaulttextfontname", "*"); endif + if (strcmp (typ, "eps")) + d_typ = "-depsc2"; + else + d_typ = cstrcat ("-d", typ); + endif if (strcmp(typ , "txt")) image_as_txt(nm); elseif (strcmp (nm, "plot")) x = -10:0.1:10; plot (x, sin (x)); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "hist")) rand ("state", 2); hist (randn (10000, 1), 30); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "errorbar")) rand ("state", 2); x = 0:0.1:10; @@ -42,23 +46,23 @@ yu = 0.1 .* rand (size (x)); errorbar (x, sin (x), yl, yu); axis ([0, 10, -1.1, 1.1]); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "polar")) polar (0:0.1:10*pi, 0:0.1:10*pi); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "mesh")) tx = ty = linspace (-8, 8, 41)'; [xx, yy] = meshgrid (tx, ty); r = sqrt (xx .^ 2 + yy .^ 2) + eps; tz = sin (r) ./ r; mesh (tx, ty, tz); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "plot3")) t = 0:0.1:10*pi; r = linspace (0, 1, numel (t)); z = linspace (0, 1, numel (t)); plot3 (r.*sin(t), r.*cos(t), z); - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) elseif (strcmp (nm, "extended")) x = 0:0.01:3; plot(x,erf(x)); @@ -67,7 +71,7 @@ axis([0, 3, 0, 1]); text(0.65, 0.6175, cstrcat('\leftarrow x = {2/\surd\pi {\fontsize{16}', '\int_{\fontsize{8}0}^{\fontsize{8}x}} e^{-t^2} dt} = 0.6175')) - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) else error ("unrecognized plot requested"); endif diff -r 5cd48568ec59 -r e76d8c767584 doc/interpreter/sparseimages.m --- a/doc/interpreter/sparseimages.m Fri Dec 04 12:55:41 2009 -0500 +++ b/doc/interpreter/sparseimages.m Fri Dec 04 10:44:58 2009 -0800 @@ -21,6 +21,7 @@ if (strcmp (typ, "png")) set (0, "defaulttextfontname", "*"); endif + if (! isempty (findstr (octave_config_info ("DEFS"), "HAVE_COLAMD")) && ! isempty (findstr (octave_config_info ("DEFS"), "HAVE_CHOLMOD")) && ! isempty (findstr (octave_config_info ("DEFS"), "HAVE_UMFPACK"))) @@ -57,11 +58,17 @@ function gplotimages (nm, typ) hide_output (); + if (strcmp (typ, "eps")) + d_typ = "-depsc2"; + else + d_typ = cstrcat ("-d", typ); + endif + A = sparse ([2,6,1,3,2,4,3,5,4,6,1,5], [1,1,2,2,3,3,4,4,5,5,6,6], 1, 6, 6); xy = [0,4,8,6,4,2;5,0,5,7,5,7]'; gplot (A, xy) - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)) + print (cstrcat (nm, ".", typ), d_typ) hide_output (); endfunction @@ -94,12 +101,18 @@ function otherimages(nm,n,typ) hide_output (); + if (strcmp (typ, "eps")) + d_typ = "-depsc2"; + else + d_typ = cstrcat ("-d", typ); + endif + a = 10*speye(n) + sparse(1:n,ceil([1:n]/2),1,n,n) + ... sparse(ceil([1:n]/2),1:n,1,n,n); if (strcmp (nm, "spmatrix")) spy(a); axis("ij") - print(cstrcat("spmatrix.",typ),cstrcat("-d",typ)) + print(cstrcat("spmatrix.",typ), d_typ) hide_output (); else if (!isempty(findstr(octave_config_info ("DEFS"),"HAVE_COLAMD")) && @@ -108,13 +121,13 @@ r1 = chol(a); spy(r1); axis("ij") - print(cstrcat("spchol.",typ),cstrcat("-d",typ)) + print(cstrcat("spchol.",typ), d_typ) hide_output (); elseif (strcmp (nm, "spcholperm")) [r2,p2,q2]=chol(a); spy(r2); axis("ij") - print(cstrcat("spcholperm.",typ),cstrcat("-d",typ)) + print(cstrcat("spcholperm.",typ), d_typ) hide_output (); endif ## printf("Image NNZ: Matrix %d, Chol %d, PermChol %d\n",nnz(a),nnz(r1),nnz(r2)); @@ -162,6 +175,12 @@ function femimages (nm,typ) hide_output (); + if (strcmp (typ, "eps")) + d_typ = "-depsc2"; + else + d_typ = cstrcat ("-d", typ); + endif + if (!isempty(findstr(octave_config_info ("DEFS"),"HAVE_COLAMD")) && !isempty(findstr(octave_config_info ("DEFS"),"HAVE_CHOLMOD")) && !isempty(findstr(octave_config_info ("DEFS"),"HAVE_UMFPACK"))) @@ -237,7 +256,7 @@ plot3 (xelems, yelems, velems); view (10, 10); - print(cstrcat(nm,".",typ),cstrcat("-d",typ)) + print(cstrcat(nm,".",typ), d_typ) hide_output (); endif endfunction @@ -258,6 +277,11 @@ else ## if (!strcmp (typ, "txt")) hide_output (); + if (strcmp (typ, "eps")) + d_typ = "-depsc2"; + else + d_typ = cstrcat ("-d", typ); + endif x = y = linspace (-8, 8, 41)'; [xx, yy] = meshgrid (x, y); @@ -267,7 +291,7 @@ mesh (x, y, z); title ("Sorry, graphics not available because octave was\\ncompiled without the sparse matrix implementation."); unwind_protect_cleanup - print (cstrcat (nm, ".", typ), cstrcat ("-d", typ)); + print (cstrcat (nm, ".", typ), d_typ); hide_output (); end_unwind_protect endif