Determine the PlotRange of a Graphics object programmatically
You can use my GraphicsInformation
function to obtain this information. Install with:
PacletInstall[
"GraphicsInformation",
"Site" -> "http://raw.githubusercontent.com/carlwoll/GraphicsInformation/master"
];
Then, load it:
<<GraphicsInformation`
For your example:
GraphicsInformation[expression]
"PlotRange" /. %
{"ImagePadding" -> {{0.5, 18.}, {11.4785, 24.}}, "ImageSize" -> {400., 261.553}, "PlotRangeSize" -> {381.5, 226.074}, "ImagePaddingSize" -> {18.5, 35.4785}, "PlotRange" -> {{-44.5312, 307.031}, {-4.16667, 204.167}}}
{{-44.5312, 307.031}, {-4.16667, 204.167}}
Note that GraphicsInformation
is more reliable than PlotRange
. For instance, compare:
PlotRange[Graphics[{}, Axes->True]]
"PlotRange" /. GraphicsInformation[Graphics[{}, Axes->True]]
{{0., 1.}, {0., 1.}}
{{-1.04167, 1.04167}, {-1.04, 1.04}}