comparison scripts/plot/print.m @ 14355:a6a5c5008e39

Print() function requires figure units to be "pixels". * print.m: Set the figure's units property to "pixels" during while the graphics toolkit produces the output.
author Ben Abbott <bpabbott@mac.com>
date Fri, 10 Feb 2012 18:16:40 -0500
parents ce2b59a6d0e5
children c097c22e9294
comparison
equal deleted inserted replaced
14354:55bb8c902a4d 14355:a6a5c5008e39
281 unwind_protect 281 unwind_protect
282 282
283 ## Modify properties as specified by options 283 ## Modify properties as specified by options
284 props = []; 284 props = [];
285 285
286 drawnow ();
287
288 ## print() requires figure units to be "pixels"
289 props(1).h = opts.figure;
290 props(1).name = "units";
291 props(1).value = {get(opts.figure, "units")};
292 set (opts.figure, "units", "pixels");
293
286 ## graphics toolkit tranlates figure position to eps bbox in points 294 ## graphics toolkit tranlates figure position to eps bbox in points
287 fpos = get (opts.figure, "position"); 295 fpos = get (opts.figure, "position");
288 props(1).h = opts.figure; 296 props(2).h = opts.figure;
289 props(1).name = "position"; 297 props(2).name = "position";
290 props(1).value = {fpos}; 298 props(2).value = {fpos};
291 fpos(3:4) = opts.canvas_size; 299 fpos(3:4) = opts.canvas_size;
292 set (opts.figure, "position", fpos); 300 set (opts.figure, "position", fpos);
293 301
294 ## Set figure background to none. This is done both for 302 ## Set figure background to none. This is done both for
295 ## consistency with Matlab and to elliminate the visible 303 ## consistency with Matlab and to elliminate the visible
296 ## box along the figure's perimeter. 304 ## box along the figure's perimeter.
297 props(2).h = opts.figure; 305 props(3).h = opts.figure;
298 props(2).name = "color"; 306 props(3).name = "color";
299 props(2).value{1} = get (props(2).h, props(2).name); 307 props(3).value{1} = get (props(3).h, props(3).name);
300 set (props(2).h, props(2).name, "none"); 308 set (props(3).h, "color", "none");
301 309
302 if (opts.force_solid != 0) 310 if (opts.force_solid != 0)
303 h = findall (opts.figure, "-property", "linestyle"); 311 h = findall (opts.figure, "-property", "linestyle");
304 m = numel (props); 312 m = numel (props);
305 for n = 1:numel(h) 313 for n = 1:numel(h)