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
.
Plot[10^6 Sin[x],{x,0,10}]
andPlot[Sin[x],{x,0,10}]
look very similar, you could place them on top of each other, however the y-range of one is +-10^6, while the other is +-1. Both plots would be 600 points wide and600/GoldenRatio
high. Axes dimensions in printer points would be similar. $\endgroup$PlotRange
?" $\endgroup$