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

*To*: mathgroup at smc.vnet.net*Subject*: [mg110764] Re: Is it possible to query current plot range values (or have*From*: "David Park" <djmpark at comcast.net>*Date*: Mon, 5 Jul 2010 06:02:48 -0400 (EDT)

The Presentations package has a command, DrawingWidths2D, that gives knowledge of the bounding box of a set of graphics primitives, which can be used while drawing other primitives. It returns the x and y ranges, the x and y centers, and the min and max values of the bounding box. For example, here we use it to find the bounding box of an ellipse produced by a ContourPlot. Needs["Presentations`Master`"] quadratic[x_, y_] := x^2 + 2 x y + 1.5 y^2 + 3 x - y + 2 {{xrange, yrrange}, {xccenter, ycenter}, {{xmin, xmax}, {ymin, ymax}}} = DrawingWidths2D[{ContourDraw[ quadratic[x, y] == 0, {x, -15, 15}, {y, -15, 15}]}] {{9.94158, 8.11799}, {-5.50227, 4.00035}, {{-10.4731, -0.531481}, {-0.0586483, 8.05934}}} Here we use it to draw the ellipse and then add a vertical line that matches the vertical range. Module[{g, xrange, yrange, xcenter, ycenter, xmin, xmax, ymin, ymax}, g = ContourDraw[quadratic, {x, -15, 15}, {y, -15, 15}, PlotRange -> All]; {{xrange, yrrange}, {xcenter, ycenter}, {{xmin, xmax}, {ymin, ymax}}} = DrawingWidths2D[{g}]; Draw2D[ {g, Line[{{xcenter, ymin}, {xcenter, ymax}}]}, PlotRange -> All, ImageSize -> 300] ] David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: Leo Alekseyev [mailto:dnquark at gmail.com] 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?.. Thanks in advance to anyone who might clarify this... --Leo