Re: Clever Tricky Solutions
- To: mathgroup at smc.vnet.net
- Subject: [mg94224] Re: Clever Tricky Solutions
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Mon, 8 Dec 2008 06:23:04 -0500 (EST)
- References: <27271771.1228394784179.JavaMail.root@m02> <ghavpg$o9j$1@smc.vnet.net> <ghdmvt$frc$1@smc.vnet.net> <ghf70d$pdu$1@smc.vnet.net>
Helen Read wrote:
> congruentialuminaire at yahoo.com wrote:
>> I was thinking that maybe this is just a bug which Mathematica V6 introduced
>> and which the PlotRange -> All specification "fixes". Indeed when I
>> ran this on a V5.2 system, both graphs show as coded by Donald. I wish
>> a WRI team member [coder or tester] would look into this and get back
>> to all of us about:
>>
>> - is this a bug? Is it "fixed" in V7?
>> - did the PlotRange default value [when unspecified] become different
>> in V6, necessitating the need for this "fix" provided by David and
>> Bobby?
>
> This was discussed here at length when v6 came out last year. WRI
> changed the default behavior of Show beginning with 6.0, because,
> according to them, with the various new graphics options (Filling, etc.)
> introduced in v6, it "often" does not make sense to combine the
> PlotRanges of the individual graphics. So instead, Show now uses the
> PlotRange from the first graphic by default. The v7 documentation for
> Show discusses this under "Possible Issues" with an example illustrating
> that "Show uses options from the first graphic". It suggests using
> PlotRange->All to see the entire plot. However, PlotRange->All often
> gives terrible results, so I tell my students to always set
> PlotRange->Automatic in Show, which makes it behave the way it did
> pre-v6. They often forget to do this, though, and don't understand why
> their plots are cut off.
>
> I greatly dislike this behavior, as I virtually *never* want the
> PlotRange from the first plot. Rather, I want the PlotRanges combined
> automatically by default, as Show did prior to v6. On the rare occasion
> where I need something else, I can always specify the PlotRange
> explicitly. I think it would make a lot more sense to have
> PlotRange->Automatic the default in Show, with some way to set it to use
> the PlotRange from the 1st graphic or the 2nd etc. if you need to.
> Something like PlotRange->{1} to get the PlotRange from the first
> graphic, or whatever.
>
> SetOptions[Show, PlotRange -> Automatic] does not even work, BTW. You
> get an error that "PlotRange is not an option for Show". So my students
> and I are stuck having to type in PlotRange->Automatic about 99% of the
> time when we use Show. If Automatic was still the default, we would
> rarely have to specify a PlotRange in Show.
>
I agree something like this should be built in to Mathematica, but in
the meantime, how about defining a little function such as:
showAll[pl_List,opts___Rule]:=Module[{plRanges,x1,x2,y1,y2},
plRanges=Map[AbsoluteOptions[#,PlotRange]&,pl];
x1=Min@plRanges[[All,1,2,1,1]];
x2=Max@plRanges[[All,1,2,1,2]];
y1=Min@plRanges[[All,1,2,2,1]];
y2=Max@plRanges[[All,1,2,2,2]];
Show[pl,PlotRange->{{x1,x2},{y1,y2}},opts]
];
showAll[{px1,px2}]
David Bailey
http://www.dbaileyconsultancy.co.uk