3

How do I extract the AspectRatio from a plot? (For example for the PlotRange, I can use PlotRange[plot]. The same does not work for the AspectRatio.)


I would be happy to extend this question into how to extract various options and attributes of plots. See for example also this question/answer about extracting viewpoints.

Syed
  • 52,495
  • 4
  • 30
  • 85
Kvothe
  • 4,419
  • 9
  • 28

1 Answers1

13

For example:

p1 = Plot[Sin[x], {x, 0, π}]
AbsoluteOptions[p1, AspectRatio]

{AspectRatio -> 0.618034}

If this number looks familiar, it is because the default AspectRatio is 1/GoldenRatio // N.

Syed
  • 52,495
  • 4
  • 30
  • 85
  • 1
    ctrl-shift-e converts any graphic into its raw expression where you can look up a wide range of values, copy them, use them in options, etc. – Rogo Apr 30 '23 at 18:18