MathGroup Archive 2008

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

Search the Archive

Re: How to sync plots?

  • To: mathgroup at
  • Subject: [mg90320] Re: How to sync plots?
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at>
  • Date: Sat, 5 Jul 2008 04:52:39 -0400 (EDT)
  • Organization: The Open University, Milton Keynes, UK
  • References: <g4klh1$m8l$>

Aaron Fude wrote:

> I produce several plots that eventually go into a GraphicsGrid. Is
> there a simple way to make sure that their PlotRanges are all
> identical? For example, they could all be set to the broadest needed
> PlotRange.

The following function should be a good starter. We extract the plot 
range specifications for each graph. Then we look for the min and max 
values for the x- and y-axes. Finally we replace the plot range 
specifications by the new one and thus for every graphs.

   normalizeRange[glist_List] :=
     Module[{prlist, xr, yr, newpr},
       prlist =
         Cases[glist, (PlotRange -> {x_, y_}) -> {x, y}, Infinity];
       xr = prlist[[All, 1]];
       yr = prlist[[All, 2]];
       newpr = {{Min[xr], Max[xr]}, {Min[yr], Max[yr]}};
       Replace[glist, (PlotRange -> {x_, y_}) -> PlotRange -> newpr,

   glist = Table[Plot[(x - 2 n)^n, {x, -2 n, 2 n}], {n, 4}]

   GraphicsGrid[Partition[normalizeRange[glist], 2]]

-- Jean-Marc

  • Prev by Date: Re: Block diagonal matrices
  • Next by Date: Re: SelectionPlaceholder in Packages
  • Previous by thread: Re: How to sync plots?
  • Next by thread: lie symmetry package