Re: How to: PlotRange->{0, All} ?
- To: mathgroup at smc.vnet.net
- Subject: [mg17354] Re: How to: PlotRange->{0, All} ?
- From: "Peltio" <peltDOT.ioNOS at PAMiolDOT.it>
- Date: Mon, 3 May 1999 01:45:56 -0400
- Organization: Peltio Inc.
- References: <7gfrl6$6eb@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Matthias Georg Imhof wrote > >Any ideas? One idea is: Plot the graph p1=Plot[Sin[x],{x,0,9},PlotRange->All]; and take the values of the y range {ymin,ymax}=Last@(PlotRange/.FullOptions[p1]); then use only the one you need a=.2; Plot[Sin[x],{x,0,9},PlotRange->{a,ymax}] Plot[Sin[x],{x,0,9},PlotRange->{ymin,a}] And a very rude way to put this in one procedure, without touching the built-in function Plot, is to define a new function for the cases PlotRange->{a,All} and PlotRange->{All,a}. This can be done by using Options and testing them inside the new function, or, in a rather barbaric manner, by brute force only: (please forgive the lack of style, it's almost 4 in the morning... ... cut and paste is so luring) myPlot[f_,rng_,opts___,PlotRange->{All,a_},opts2___]:= Module[{p1,ymin,ymax}, p1=Plot[f,rng,PlotRange->All,DisplayFunction->Identity,opts,opts2]; {ymin,ymax}=Last@(PlotRange/.FullOptions[p1]); Show[p1,PlotRange->{ymin,a},DisplayFunction->$DisplayFunction] ] myPlot[f_,rng_,opts___,PlotRange->{a_,All},opts2___]:= Module[{p1,ymin,ymax}, p1=Plot[f,rng,PlotRange->All,DisplayFunction->Identity,opts,opts2]; {ymin,ymax}=Last@(PlotRange/.FullOptions[p1]); Show[p1,PlotRange->{a,ymax},DisplayFunction->$DisplayFunction] ] Well, at least it seems to work: myPlot[Sin[x],{x,0,9},PlotRange->{.2,All}]; myPlot[Sin[x],{x,0,9},PlotRange->{All,.2}]; Hope this could be of some help. Regards, Peltio P.S. I fear there is an HoldAll attribute to raise for the myPlot function...