comparison scripts/plot/print.m @ 9056:b06dc393ac42

print.m: For eps output the bounding box should represent the figure's position.
author Ben Abbott <bpabbott@mac.com>
date Sun, 29 Mar 2009 00:32:01 -0400
parents 97aa01a85ea4
children d0d507cbd123
comparison
equal deleted inserted replaced
9055:8651fcc89556 9056:b06dc393ac42
426 addproperty ("__pixels_per_inch__", gcf, "double", resolution); 426 addproperty ("__pixels_per_inch__", gcf, "double", resolution);
427 endif 427 endif
428 set (gcf, "__pixels_per_inch__", resolution) 428 set (gcf, "__pixels_per_inch__", resolution)
429 429
430 unwind_protect 430 unwind_protect
431 if (! isempty (size)) 431 if (! isempty (size) || any (strfind (dev, "eps") == 1))
432 size_in_pixels = sscanf (size ,"%d, %d");
433 size_in_pixels = reshape (size_in_pixels, [1, numel(size_in_pixels)]);
434 size_in_inches = size_in_pixels ./ resolution;
435 p.paperunits = get (gcf, "paperunits"); 432 p.paperunits = get (gcf, "paperunits");
436 p.papertype = get (gcf, "papertype"); 433 p.papertype = get (gcf, "papertype");
437 p.papersize = get (gcf, "papersize"); 434 p.papersize = get (gcf, "papersize");
438 p.paperposition = get (gcf, "paperposition"); 435 p.paperposition = get (gcf, "paperposition");
439 p.paperpositionmode = get (gcf, "paperpositionmode"); 436 p.paperpositionmode = get (gcf, "paperpositionmode");
440 set (gcf, "paperunits", "inches"); 437 set (gcf, "paperunits", "inches");
438 if (any (strfind (dev, "eps") == 1))
439 paperposition_in_inches = get (gcf, "paperposition") + 1/72;
440 paperposition_in_inches(1:2) = 0;
441 papersize_in_inches = paperposition_in_inches(3:4);
442 else
443 size_in_pixels = sscanf (size ,"%d, %d");
444 size_in_pixels = reshape (size_in_pixels, [1, numel(size_in_pixels)]);
445 papersize_in_inches = size_in_pixels ./ resolution;
446 paperposition_in_inches = [0, 0, papersize_in_inches];
447 endif
441 set (gcf, "papertype", "<custom>"); 448 set (gcf, "papertype", "<custom>");
442 set (gcf, "papersize", size_in_inches); 449 set (gcf, "papersize", papersize_in_inches);
443 set (gcf, "paperposition", [0, 0, size_in_inches]); 450 set (gcf, "paperposition", paperposition_in_inches);
444 set (gcf, "paperpositionmode", "manual"); 451 set (gcf, "paperpositionmode", "manual");
445 endif 452 endif
446 if (debug) 453 if (debug)
447 drawnow (new_terminal, name, mono, debug_file); 454 drawnow (new_terminal, name, mono, debug_file);
448 else 455 else
449 drawnow (new_terminal, name, mono); 456 drawnow (new_terminal, name, mono);
450 endif 457 endif
451 unwind_protect_cleanup 458 unwind_protect_cleanup
452 ## FIXME - it would be preferred to delete the added properties here. 459 ## FIXME - it would be nice to delete "__pixels_per_inch__" property here.
453 if (! isempty (size)) 460 if (! isempty (size) || any (strfind (dev, "eps") == 1))
454 props = fieldnames (p); 461 props = fieldnames (p);
455 for n = 1:numel(props) 462 for n = 1:numel(props)
456 set (gcf, props{n}, p.(props{n})) 463 set (gcf, props{n}, p.(props{n}))
457 endfor 464 endfor
458 endif 465 endif