MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Precicely defining plot size

  • To: mathgroup at smc.vnet.net
  • Subject: [mg123523] Re: Precicely defining plot size
  • From: Armand Tamzarian <mike.honeychurch at gmail.com>
  • Date: Sat, 10 Dec 2011 07:27:59 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jbspm1$3r9$1@smc.vnet.net>

On Dec 9, 9:59 pm, premiumxy <s... at stefanabel.com> wrote:
> Hello,
>
> I have layout problem, and I just cannot get it solved even after trying for a long time now...
>
> To make it simple: I want to create a plot with frame->true (that I after wards export to a *.eps file) with a precise frame size, let's say 2inch.
>
> Plot[Sin[x],{x,0,10},ImageSize->144]
>
> How do you have access to the frame size within a plot?! I know that by I mageSize->144 the whole image will be 2inch large. But this includes the ticks and the frame-labels. I can make paddings, or reduce the plotRegion, but always including the labels...
>
> It sounds like an easy problem. Has anybody an idea?
>
> Thanks a lot!

With an ImageSize of 144 the frame will only be 144 if ImagePadding is
zero. So what you need to do is explicitly set some image padding and
add that to the "frame size" to get your final image size:

(* padding *)
{{l, r}, {b, t}} = {{30, 30}, {30, 30}};

(* amount this adds to the size *)
{w, h} = Total /@ {{l, r}, {b, t}};

(* aspect ratio *)
aspectratio = 1./GoldenRatio;

(* frame size *)
framesize = {144, 144*aspectratio}

Plot[Sin[x], {x, 0, 10},
 Frame -> True,
 ImageSize -> framesize + {w, h},
 ImagePadding -> {{l, r}, {b, t}}]

This is also important in dynamic plots when you are resizing -- it
allows you to keep everything a fixed size or alternatively you can
resize will scale everything correctly.

Mike
http://ibnhconsulting.blogspot.com/



  • Prev by Date: Re: Solve the eigenvalues of the matrix A1,thx!~
  • Next by Date: Re: LinearProgramming[]
  • Previous by thread: Precicely defining plot size
  • Next by thread: Re: Precicely defining plot size