# Specifying the PlotRange according to a desired center

I have this plot of $f(x)=\ln x$ and the tangent line at $x=e$, and I'd like to specify the PlotRange so that it's the rectangle with its centroid at $(e,1)$, kind of like how ViewCenter is used for 3D graphics. Supposing I'm plotting over $[0,2e]$, is there a good way to do this without manually determining the vertices of such a rectangle?

I'm trying to make this visual demonstration of linear approximations showing that, as you zoom in on the plot, the distance between the tangent and the curve gets smaller and smaller to the point of making it hard to distinguish between the two. So, on top of centering the plot, I'd like to use Manipulate give the option of adjusting this zooming window, but I'm not sure how to set up the PlotRange to begin with.

• Manipulate[ Plot[{Log[x], (x - E)/E + 1}, {x, E (1 - E^-a), E (1 + E^-a)}, Frame -> True, GridLines -> Automatic], {a, 0, 5}] Does this qualify as not manually determining the rectangle? – LLlAMnYP Jul 13 '15 at 20:03

Could you use

PlotRange->{{e-w,1-h},{e+w,1+h}}


Where w,h are the 1/2 width and 1/2 height of the zoom box?

• I think you meant {{E-w, E+w}, {1-h, 1+h}}? But yes, this should do the trick. – user170231 Jul 13 '15 at 20:08

Manipulate[

The ImagePadding is necessary in order to get rid of the annoying jitter that occurs when the axes labels change. PlotRange -> All makes sure that the entire set of y-values are shown for the given PlotRange. This makes things slightly more general in that you don't need to specify the y range.