Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9771

Re: Controlling scale of Graphics on paper

From Yves Klett <yves.klett@googlemail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Controlling scale of Graphics on paper
Date 2012-04-24 09:32 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jn5rum$nr4$1@smc.vnet.net> (permalink)
References <jmtd9i$sim$1@smc.vnet.net> <jn388q$g83$1@smc.vnet.net>

Show all headers | View raw


Addendum to my first post:

This does only work properly if the PlotRange of the graphics object is
set to reflect the values of "format" (had not used that one in a while).

So making sure your dimensions are correct by using ghostview is always
a good idea ;-)

So the right way to use this is:

gfx = Graphics[Line[{{10, 10}, {110, 10}, {110, 110}}],
  PlotRange -> {{0, 200}, {0, 200}}]

ExportScaled[filename_, gfx_, format_: {210, 297}, opts___?OptionQ] :=
  Module[{mm}, mm = 72/25.4;
  Export[filename,
   Show[gfx, ImageSize -> format*mm, ImageMargins -> 0,
    ImagePadding -> None, AspectRatio -> Automatic], opts]]

ExportScaled["test.eps", gfx, -Subtract @@@ (PlotRange /.
     Options[gfx, PlotRange])]

It is a good idea to set the PlotRange values for your graphics object
*explicitely*, because extracting the with FullOptions can result in
added whitespace (at least in some cases).

Regards,
Yves



Am 23.04.2012 11:43, schrieb Yves Klett:
> ExportScaled[filename_,gfx_,format_:{210,297},opts___?OptionQ]:=Module[{mm},
> mm=72/25.4;
> Export[filename,Show[gfx,ImageSize->format*mm,ImageMargins->0,ImagePadding->None,AspectRatio->Automatic],opts]
> ]

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Controlling scale of Graphics on paper Joseph Gwinn <joegwinn@comcast.net> - 2012-04-21 04:32 +0000
  Re: Controlling scale of Graphics on paper Yves Klett <yves.klett@googlemail.com> - 2012-04-23 09:43 +0000
    Re: Controlling scale of Graphics on paper Yves Klett <yves.klett@googlemail.com> - 2012-04-24 09:32 +0000
      Re: Controlling scale of Graphics on paper Joseph Gwinn <joegwinn@comcast.net> - 2012-04-26 09:27 +0000
  Re: Controlling scale of Graphics on paper Szabolcs Horvát <szhorvat@gmail.com> - 2012-04-27 10:52 +0000
    Re: Controlling scale of Graphics on paper Joseph Gwinn <joegwinn@comcast.net> - 2012-04-29 06:14 +0000

csiph-web