Re: Detect automatically chosen value for PlotRange in Epilog?
- To: mathgroup at smc.vnet.net
- Subject: [mg105827] Re: [mg105793] Detect automatically chosen value for PlotRange in Epilog?
- From: "David Park" <djmpark at comcast.net>
- Date: Sun, 20 Dec 2009 06:56:53 -0500 (EST)
- References: <12890052.1261223184684.JavaMail.root@n11>
Those who have the Presentations package can do this in the following manner. The specification uses the Presentations routine DrawingWidths2D. DrawingWidths2D[{primitives}] will return the widths, center point and bounds of the bounding box that contains the list of primitives. I also changed the example somewhat such that the drawing routine would not know the width of the plot in advance. Needs["Presentations`Master`"] plotExample[a_?NumericQ] := Module[ {xmin, xmax, maingraphics}, (* Draw the main part of the graphic *) maingraphics = ParametricDraw[{a Sin[y], y}, {y, -3, 3}]; (* Find the limits of x plot range *) {xmin, xmax} = Part[DrawingWidths2D[maingraphics], 3, 1]; Draw2D[ {maingraphics, (* Draw the arrows for the given x range only *) Red, Arrow[{{#, 0}, {#, 1}}] & /@ Range[Floor[xmin], Ceiling[xmax]]}, Frame -> True, Axes -> True, AxesStyle -> GrayLevel[.7], AxesStyle -> GrayLevel[.7]] ] plotExample[4.5] It's too bad that Frame -> True is not the default for all Mathematica plots that use scales. Axes plots are usually quite poor because the axes and tick values stomp all over the data. The data is the important thing. It is very difficult to find axes plots in journals such as Science - unless the origin is at the lower left hand corner. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: Chris Rodgers [mailto:see-rodgers-org-uk-for-contact-details at invalid.gg] Hi, I want to add some arrows to a plot, like this: Plot[0, {x, -5, 5}, Epilog -> {Red, Arrow[{{#, 0}, {#, 1}}] & /@ Range[-10, 500]}] When plotting more complicated functions, can I detect inside Epilog what value Mathematica chose for the PlotRange? I looked at AbsoluteOptions[...], but I don't know how to get the handle for the currently plotting graphics object. My aim is to restrict my arrow drawing so that I only attempt to draw arrows that will actually appear in the plot. I hope this will speed things up. Thanks, Chris.