Get Axes Range of Plot?

Also

PlotRange[plot]
PlotRange /. AbsoluteOptions[plot]
Last @@ AbsoluteOptions[plot, PlotRange]
PlotRange /. plot[[2]]

all give

(* {{0.,10.},{-0.999999,1.}} *)

Note: Regarding usage of PlotRange as a function, it is undocumented, and the earliest reference I could find on this site is this answer dated Oct 11, 2012:

  • The same range on each plot in a grid.

Since then, also used in

  • PlotRange adjustments with BarChart
  • How can I transpose x and y axis on a Plot?
  • Plotting discrete data but not using DiscretePlot function

FilterRules[AbsoluteOptions[plot], PlotRange] does the trick

(*{PlotRange -> {{0., 10.}, {-0.999999, 1.}}} *)

Not sure if this is an exhaustive answer.


Anyway, while I wait for my flight, here's some code that'll give you everything there is to know about a plot.

GetGeometry[g_Graphics] :=
    Module[{
        q,
        dim,
        plotrange=PlotRange/.AbsoluteOptions[g,PlotRange],
        },

        q=Rasterize[Show[g,
                    Epilog->{Annotation[Rectangle[ImageScaled[{0,0}],ImageScaled[{1,1}]],"One","Region"],
                            Annotation[Rectangle[Scaled[{0,0}],Scaled[{1,1}]],"Two","Region"]}],"Regions"][[-2;;-1,2]];

        s=q[[1,2]]-q[[1,1]];
        q=q[[2]];
        dim=If[Norm[s-ImageDimensions[g]]<Sqrt[2],s,ImageDimensions[g]];

        {
        "PlotRange"->plotrange,
        "ImageSize"->dim,
        "PlotRangeSize"->q[[2]]-q[[1]],
        "ImagePadding"->{{q[[1,1]],dim[[1]]-q[[2,1]]},{dim[[2]]-q[[2,2]],q[[1,2]]}},
        "AspectRatio"->(q[[2,2]]-q[[1,2]])/(q[[2,1]]-q[[1,1]]),
        "ImageScaledToScaled"->(({{-q[[1,1]],-dim[[2]]+q[[2,2]]},{dim[[1]]-q[[2,1]],q[[1,2]]}})/(q[[2]]-q[[1]]))+{{0,0},{1,1}}
        }
    ]

Edit

The code above had some excessive definitions which I removed (the full version of my function calculates the amount of padding necessary for the ticks and frame labels).

Most of the output of the function is self-explanatory, but "PlotRangeSize" gives the size of the PlotRange in printer points and "ImageScaledToScaled" gives the coordinates of Scaled[{0,0}] and Scaled[{1,1}] in terms of ImageScaled.