comparison doc/interpreter/splineimages.m @ 20351:d8992a16643c

doc: Clean up m-files which generate images for Manual. * geometryimages.m, interpimages.m, plotimages.m, sparseimages.m, splineimages.m: Use the same style throughout the mi-files. Obey Octave coding conventions.
author Rik <rik@octave.org>
date Thu, 09 Jul 2015 21:38:57 -0700
parents c3c1fb44f9b5
children b439ccc9a162
comparison
equal deleted inserted replaced
20350:b9d4ccf4291c 20351:d8992a16643c
18 18
19 function splineimages (d, nm, typ) 19 function splineimages (d, nm, typ)
20 graphics_toolkit ("gnuplot"); 20 graphics_toolkit ("gnuplot");
21 set_print_size (); 21 set_print_size ();
22 hide_output (); 22 hide_output ();
23 outfile = fullfile (d, strcat (nm, ".", typ)); 23 outfile = fullfile (d, [nm "." typ]);
24 if (strcmp (typ, "png")) 24 if (strcmp (typ, "png"))
25 set (0, "defaulttextfontname", "*"); 25 set (0, "defaulttextfontname", "*");
26 endif 26 endif
27 if (strcmp (typ, "eps")) 27 if (strcmp (typ, "eps"))
28 d_typ = "-depsc2"; 28 d_typ = "-depsc2";
107 y1 = ppval (pp1, xx); 107 y1 = ppval (pp1, xx);
108 y2 = ppval (pp2, xx); 108 y2 = ppval (pp2, xx);
109 plot (x, y, ".", xx, [y1; y2]); 109 plot (x, y, ".", xx, [y1; y2]);
110 axis tight; 110 axis tight;
111 ylim ([-1.5 1.5]); 111 ylim ([-1.5 1.5]);
112 legend({"data", "clamped", "hinged periodic"}); 112 legend ({"data", "clamped", "hinged periodic"});
113 print (outfile, d_typ); 113 print (outfile, d_typ);
114 elseif (strcmp (nm, "splinefit5")) 114 elseif (strcmp (nm, "splinefit5"))
115 ## Truncated data 115 ## Truncated data
116 x = [0, 1, 2, 4, 8, 16, 24, 40, 56, 72, 80] / 80; 116 x = [0, 1, 2, 4, 8, 16, 24, 40, 56, 72, 80] / 80;
117 y = [0, 28, 39, 53, 70, 86, 90, 79, 55, 22, 2] / 1000; 117 y = [0, 28, 39, 53, 70, 86, 90, 79, 55, 22, 2] / 1000;
170 170
171 ## Use this function before plotting commands and after every call to 171 ## Use this function before plotting commands and after every call to
172 ## print since print() resets output to stdout (unfortunately, gnpulot 172 ## print since print() resets output to stdout (unfortunately, gnpulot
173 ## can't pop output as it can the terminal type). 173 ## can't pop output as it can the terminal type).
174 function hide_output () 174 function hide_output ()
175 f = figure (1); 175 hf = figure (1);
176 set (f, "visible", "off"); 176 set (hf, "visible", "off");
177 endfunction 177 endfunction
178 178
179 ## generate something for the texinfo @image command to process 179 ## generate something for the texinfo @image command to process
180 function image_as_txt(d, nm) 180 function image_as_txt (d, nm)
181 fid = fopen (fullfile (d, strcat (nm, ".txt")), "wt"); 181 fid = fopen (fullfile (d, [nm ".txt"]), "wt");
182 fputs (fid, "\n"); 182 fputs (fid, "\n");
183 fputs (fid, "+---------------------------------+\n"); 183 fputs (fid, "+---------------------------------+\n");
184 fputs (fid, "| Image unavailable in text mode. |\n"); 184 fputs (fid, "| Image unavailable in text mode. |\n");
185 fputs (fid, "+---------------------------------+\n"); 185 fputs (fid, "+---------------------------------+\n");
186 fclose (fid); 186 fclose (fid);