MathGroup Archive 2003

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

Search the Archive

Re: He said DisplayTogetherArray, but ...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43163] Re: He said DisplayTogetherArray, but ...
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Fri, 15 Aug 2003 04:27:09 -0400 (EDT)
  • References: <bh26jl$hp5$1@smc.vnet.net> <200308120843.EAA20927@smc.vnet.net> <bhd8qq$rm3$1@smc.vnet.net> <bhfkie$6bn$1@smc.vnet.net>
  • Reply-to: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Sender: owner-wri-mathgroup at wolfram.com

Paul,

The reason that

  DisplayTogetherArray[

      Partition[
        Graphics[{Hue[#],Rectangle[{0, 0}, {1, 1}]},
           AspectRatio -> Automatic] & /@ Range[0, 0.9, 0.1], 3
       ]

  ];

but the following does

   DisplayTogetherArray[
     Evaluate[
       Partition[
         Graphics[{Hue[#],Rectangle[{0, 0}, {1, 1}]},
           AspectRatio -> Automatic] & /@ Range[0, 0.9, 0.1], 3
       ]
     ]

   ];

is that DisplayTogetherArray is HoldAll and in the code we have

DisplayTogetherArray[plots__, opts : (_Rule | _RuleDelayed) ...] :=
Show[GraphicsArray[suppressdisplay[{plots}]], opts,
FilterOptions[{DisplayFunction}, Options[DisplayTogether]]]
This gives an extra {..} round the the partioned list. With Evaluate
DisplayTogetherArray sees that it is getting a list and so uses

DisplayTogetherArray[plotarray_List, opts : (_Rule | _RuleDelayed) ...] :=
Show[GraphicsArray[suppressdisplay[plotarray]], opts,
FilterOptions[{DisplayFunction}, Options[DisplayTogether]]]

Noting this mecahnism, we see that the following also works

DisplayTogetherArray[
     Sequence@@
       Partition[
         Graphics[{Hue[#],Rectangle[{0, 0}, {1, 1}]},
           AspectRatio -> Automatic] & /@ Range[0, 0.9, 0.1], 3

     ]

   ];

And this is preferable in

DisplayTogetherArray[
Sequence @@ Table[Plot[x, {x, 0, 1}], {2}, {3}]]

since using Evaluate displays the intermediate plots.


Allan
---------------
Allan Hayes
hay at haystack.demon.co.uk
Voice: +44 (0)116 241 8747
Fax: +44 (0)870 164 0565





"Paul Abbott" <paul at physics.uwa.edu.au> wrote in message
news:bhfkie$6bn$1 at smc.vnet.net...
> In article <bhd8qq$rm3$1 at smc.vnet.net>,
>  Murray Eisenberg <murray at math.umass.edu> wrote:
>
> > How is DisplayTogetherArray different here -- at least in what is
> > displayed -- from a simple Show (wrapped around the GraphicsArray
> > expression, of course)?
>
> You are correct:
>
>   Show[
>     GraphicsArray[
>       Partition[
>         Graphics[{Hue[#], Rectangle[{0, 0},{1, 1}]},
>           AspectRatio -> Automatic] & /@ Range[0, 0.9, 0.1], 3
>       ]
>     ]
>   ];
>
> works fine and, in this case, there are no intermediate graphics to
> suppress.
>
> > Note, also, that the documentation for DisplayTogetherArray says:
> >
> >    DisplayTogetherArray[plotcommands, opts] takes a sequence of
> >    plot commands ...and combines them to produce a GraphicsArray
> >    of the plots.
> >
> > That documentation would seem to suggest that the GraphicsArray is _not_
> > required!  (Although, in fact, that is not the case!)
>
> The documentation is slightly misleading. For example
>
>   DisplayTogetherArray[
>     {
>      {Plot[Sin[x], {x, 0, 3}], Plot[Sin[x], {x, 0, 3}]},
>      {Plot[Sin[x], {x, 0, 3}]}
>     }
>   ];
>
> works fine. (Note that this would be different with Show and
> GraphicsArray).
>
> For the problem under consideration here, an Evaluate is required:
>
>   DisplayTogetherArray[
>     Evaluate[
>       Partition[
>         Graphics[{Hue[#],Rectangle[{0, 0}, {1, 1}]},
>           AspectRatio -> Automatic] & /@ Range[0, 0.9, 0.1], 3
>       ]
>     ]
>   ];
>
> Cheers,
> Paul
>
> --
> Paul Abbott                                   Phone: +61 8 9380 2734
> School of Physics, M013                         Fax: +61 8 9380 1014
> The University of Western Australia      (CRICOS Provider No 00126G)
> 35 Stirling Highway
> Crawley WA 6009                      mailto:paul at physics.uwa.edu.au
> AUSTRALIA                            http://physics.uwa.edu.au/~paul
>


  • Prev by Date: Re: He said DisplayTogetherArray, but ...
  • Next by Date: nonfunctions
  • Previous by thread: Re: Re: He said DisplayTogetherArray, but ...
  • Next by thread: Re: He said DisplayTogetherArray, but ...