Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

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

Search the Archive

Re: No Show

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89112] Re: No Show
  • From: Helen Read <hpr at together.net>
  • Date: Mon, 26 May 2008 01:29:34 -0400 (EDT)
  • References: <g1bf08$mcv$1@smc.vnet.net>
  • Reply-to: HPR <read at math.uvm.edu>

Narasimham wrote:
> Why is the following plot, bot, (with - Sqrt) not Shown along with
> top?
> 
> Why is it treated only as a plot skeleton, so no combining is
> possible?
> 
> bot = Plot3D[-Sqrt[1 - (x^2 + y^2) ] , {x, -1, 1}, {y, -1, 1}]
> top = Plot3D[+Sqrt[1 - (x^2 + y^2) ] , {x, -1, 1}, {y, -1, 1}]
> Show[top, bot]

Oh, you are going to get a lot of replies to this. It was discussed at 
length when v.6 was first released. Basically, as of v.6, the  default 
behavior of Show is to get the PlotRange from the first plot listed. See 
what happens if you reverse it.

Show[bot, top]

The way to get something more like you are expecting is to set 
PlotRange->Automatic within Show.

bot = Plot3D[-Sqrt[1 - (x^2 + y^2)], {x, -1, 1}, {y, -1, 1}];
top = Plot3D[+Sqrt[1 - (x^2 + y^2)], {x, -1, 1}, {y, -1, 1}];
Show[top, bot, PlotRange -> Automatic]

You might also want to set the BoxRatios.

bot = Plot3D[-Sqrt[1 - (x^2 + y^2)], {x, -1, 1}, {y, -1, 1}];
top = Plot3D[+Sqrt[1 - (x^2 + y^2)], {x, -1, 1}, {y, -1, 1}];
Show[top, bot, PlotRange -> Automatic, BoxRatios -> {1, 1, 1}]

I greatly dislike this new behavior of Show, for what it's worth. The 
folks at WRI argue that because of all the new graphics options (e.g., 
Filling), it would not make sense to combine the PlotRange automatically 
(as Show did in previous versions of Mathematica). Personally, I find it 
to be a pain in the neck to have to ask for PlotRange->Automatic 
virtually every time I use Show, and my students often forget and get 
burned by it. I would much prefer PlotRange->Automatic to be the default 
in Show, and to set my own PlotRange manually on those infrequent 
occasions when I need something else. And as for the argument that 
setting a PlotRange automatically from the combined plots isn't always 
appropriate, why not provide an easy way to tell Show to use the 
PlotRange from a particular plot? Something like PlotRange->{1} to get 
the PlotRange from the first plot, PlotRange->{2} to get the range from 
the 2nd plot, etc., would do the job when needed, and still allow 
PlotRange->Automatic (which for me is almost always what I want) to be 
the default.

I just now discovered, BTW, that

SetOptions[Show, PlotRange -> Automatic]

does not even work. It generates an error message claiming that 
"PlotRange is not a known option for Show".

-- 
Helen Read
University of Vermont


  • Prev by Date: Re: Re: Solve's Strange Output
  • Next by Date: Re: Re: Solve's Strange Output
  • Previous by thread: Re: No Show
  • Next by thread: Re: Re: No Show