Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I can suggest the following <code>Ticks</code> hack:</p> <pre><code>pl = Plot[Sin[x], {x, 0, 10}]; Reap[Rasterize[Show[pl, Ticks -&gt; {Sow[{##}] &amp;, Sow[{##}] &amp;}, ImageSize -&gt; 0], ImageResolution -&gt; 1]][[2, 1]] =&gt; {{-0.208333, 10.2083}, {-1.04167, 1.04167}} </code></pre> <p>The trick is that real <code>PlotRange</code> is determined by the FrontEnd, not by the Kernel. So we must force the FrontEnd to render the graphics in order to get tick functions evaluated. This hack gives the complete <code>PlotRange</code> with explicit value of <code>PlotRangePadding</code> added. </p> <p>More general solution taking into account a possibility that <code>pl</code> has non-standard value of <code>DisplayFinction</code> option and that it may have <code>Axes</code> option set to <code>False</code>:</p> <pre><code>completePlotRange[plot:(_Graphics|_Graphics3D|_Graph)] := Quiet@Last@ Last@Reap[ Rasterize[ Show[plot, Axes -&gt; True, Frame -&gt; False, Ticks -&gt; (Sow[{##}] &amp;), DisplayFunction -&gt; Identity, ImageSize -&gt; 0], ImageResolution -&gt; 1]] </code></pre> <p>One can get the exact <code>PlotRange</code> (without the <code>PlotRangePadding</code> added) with the following function:</p> <pre><code>plotRange[plot : (_Graphics | _Graphics3D | _Graph)] := Quiet@Last@ Last@Reap[ Rasterize[ Show[plot, PlotRangePadding -&gt; None, Axes -&gt; True, Frame -&gt; False, Ticks -&gt; (Sow[{##}] &amp;), DisplayFunction -&gt; Identity, ImageSize -&gt; 0], ImageResolution -&gt; 1]] </code></pre> <hr> <p>P.S. On the Documentation page for <code>PlotRange</code> under the "More information" one can read: "<code>AbsoluteOptions</code> gives the actual settings for options used internally by <em>Mathematica</em> <strong>when the setting given is <code>Automatic</code> or <code>All</code></strong>. " (emphasis mine). So it seems that the Documentation does not even guarantee that <code>AbsoluteOptions</code> will give correct values for <code>PlotRange</code> when it is not <code>Automatic</code> or <code>All</code>. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload