Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: Aligning subplots nicely?

  • To: mathgroup at
  • Subject: [mg31691] Re: [mg31659] Aligning subplots nicely?
  • From: BobHanlon at
  • Date: Sat, 24 Nov 2001 16:44:07 -0500 (EST)
  • Sender: owner-wri-mathgroup at

In a message dated 2001/11/23 8:30:02 AM, shsmolan at writes:

>Is there a handy way to aling subplots nicely?
>For example, if I have
>  {p1, p2} = {Plot[x^2, {x, 0, 1}], Plot[x^2, {x, 0, 0.1}]}
>and then I do
>  Show[GraphicsArray[{p1, p2}]]
>Then the two subplots are of different size (because in p2 the
>numbers in y-axis are longer, and take relatively more or
>the rectangle that GraphicsArray assignes to the subplot),
>and the result looks ugly.
>I found out that I can do this:
>Show[Graphics[{Rectangle[{0, 0}, {1, 1}, kk1], 
>               Rectangle[{1, -0.02}, {2.18, 1.05}, kk2]}]];
>It looks relatively nice (at leat in certain size),
>but I need lots of iterative handwork to tune the
>rectangle parameters.
>Any better ways?

One approach is to pad out the short axes labels to be the same length as the 

        DisplayFunction -> Identity],
        DisplayFunction -> Identity]};

        p1 /. (Ticks -> Automatic) :>  
            (Ticks -> {Automatic, 
                  (Ticks /. AbsoluteOptions[p1])[[2]] /. {x_?NumericQ, lab_, 
                        rem__} :> 
                      {x, PaddedForm[lab, {3, 3}], rem}}),
    DisplayFunction -> $DisplayFunction, 
    ImageSize -> 440];

Bob Hanlon
Chantilly, VA  USA

  • Prev by Date: Re: KroneckerDelta in sum
  • Next by Date: RE: Loop through a notebook
  • Previous by thread: Aligning subplots nicely?
  • Next by thread: RE: Aligning subplots nicely?