MathGroup Archive 2010

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

Search the Archive

Re: Is it possible to query current plot range values (or have

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110755] Re: Is it possible to query current plot range values (or have
  • From: Helen Read <hpr at together.net>
  • Date: Mon, 5 Jul 2010 06:01:07 -0400 (EDT)
  • References: <i0pc5p$jut$1@smc.vnet.net>
  • Reply-to: HPR <read at math.uvm.edu>

On 7/4/2010 3:10 AM, Leo Alekseyev wrote:
> Some of my plots contain vertical lines for alignment.  To make sure
> the lines extend from the top to the bottom of the plot frame, I
> typically give those lines large values for +y and -y coordinates.
> This has an unfortunate side effect that the directive PlotRange->All
> now considers my line to be a part of the plot, and rescales the plot
> range to display it in its entirety.  Is there a way to (a) either
> make PlotRange->All ignore this line somehow or (b) set the +y and -y
> coordinates of the line to match the current plot range?..

Use GridLines.

For example:

f[x_] = x^2;
g[x_] = x^3;
Plot[{f[x], g[x]}, {x, -3, 3}, GridLines -> {{-2, 2}, None},
  GridLinesStyle -> Directive[Red, Dashed]]


Plot[{f[x], g[x]}, {x, -5, 5}, GridLines -> {{-2, 2}, None},
  GridLinesStyle -> Directive[Red, Dashed]]

Plot[{f[x], g[x]}, {x, -5, 5}, GridLines -> {{-2, 2}, None},
  GridLinesStyle -> Directive[Red, Dashed], PlotRange -> {-10, 10}]

GridLines scale appropriately according to the PlotRange. You can even 
style the GridLines individually if you like.

BTW, it is helpful to post an example of what you are talking about that 
others can copy/paste into Mathematica and evaluate, instead of having 
to make up their own examples that may or may not reflect what you are 
talking about.


-- 
Helen Read
University of Vermont


  • Prev by Date: Re: precedence for ReplaceAll?
  • Next by Date: Re: FindRoot with parameterized interpolated function from NDSolve
  • Previous by thread: Re: Is it possible to query current plot range values (or have
  • Next by thread: Re: Is it possible to query current plot range values (or have