Re: setting X and Y range in 2D plots
- To: mathgroup at smc.vnet.net
- Subject: [mg15377] Re: setting X and Y range in 2D plots
- From: Hans Staugaard Nielsen <hsn at imf.au.dk>
- Date: Tue, 12 Jan 1999 03:14:42 -0500
- Organization: Department of Mathematical Sciences, University of Aarhus
- References: <779crp$bgi@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jorge Zickermann wrote:
>
> Drazen,
>
> As far as I know, the following applies to any type of plot of a 2D
> function. Lets say you have a function defined...
>
> y[x_]:=x^2
>
> You can plot the result for a defined range of x using the automatic
> setup of axes by Mathematica.
>
> graphic = Plot[y[x],{x,-10,10}]
>
> Then, at any time, you can show the defined plot for a PlotRange
> (window) of your will...
>
> Show[graphic,PlotRange->{{-5,5},{0,10}}]
>
> where the ranges of x and y, to be seen, are defined.
>
> If you copy the inputs above into a notebook, and evaluate them, you
> will see that the definition of graphic gives a plot, which I suppose
> you don't want to see. Unlike with common input cells for which a
> following semicollon (;) hides the result, with Plot that doesn't
> happen. If you only want to see a particular window at all times, then
> you have to contract the inputs into the following form...
>
> graphic = Plot[y[x],{x,-10,10},PlotRange->{{-5,5},{0,10}}]
Or you could say
graphics=Plot[y[x],{x,-10,10},DisplayFunction->Identity]
This does not display the plot,
and then have another function
showwindow[pltrange_]:=Show[graphics,PlotRange->pltrange,
DisplayFunction->$DisplayFunction]
Which only displays the window you want
>
> Notice that if you ask for a PlotRange wider than that obtained for
> the variation of x, you won't get a complete plot. ie; If in the
> PlotRange above you wanted to see a window {{-5,12},{0,10}} you would
> have to make x vary up to 12, {x,-10,12}.
This still applies.
Hans