8
$\begingroup$

This has been fixed in version 13.0.

Also seems to work with explicit Automatic, None, All etc. statements.


I just come across a function called AbsoluteOptions when trying to figure out the specific option value of Ticks -> Automatic in Plot, which, as said in its document, will give "the actual settings for options used internally by the Wolfram Language when the setting given is Automatic or All", but it seems not to work properly. Consider the following example:

p1 = Plot[Sin[x], {x, 0, 4}]
option = First@AbsoluteOptions[p1, Ticks];
p2 = Plot[Sin[x], {x, 0, 4}, Evaluate@option]

enter image description here enter image description here

Apparently p1 and p2 are different, what have I missed?

If AbsoluteOptions just doesn't work, how can I find the specific value of default setting of Ticks?

I'm still using v9.0.1.

$\endgroup$
10
  • 8
    $\begingroup$ Yep, long standing problem. AbsoluteOptions is just a rough approximation. I believe that might be because AbsoluteOptions is implemented within the kernel while the automatic graphics features are really computed by the front end, based on things such as the size of text based on available fonts, etc. that the kernel has no access to. But I might be wrong. $\endgroup$
    – Szabolcs
    Oct 18, 2015 at 15:50
  • 5
    $\begingroup$ AbsoluteOptions for graphics and FullGraphics last worked properly in version 5. Perhaps you should report it as a bug, although I'm sure many people have done already in the 8 years since version 6 was released. I don't hold out much hope that these will be fixed in the near future. $\endgroup$ Oct 18, 2015 at 16:19
  • 3
    $\begingroup$ Searching for those two functions here should give you a list of questions about problems that are effectively the same as yours. It really is annoying that these two have been seemingly abandoned. $\endgroup$ Oct 18, 2015 at 16:44
  • 3
    $\begingroup$ @xzczd Yes, I realized that. As I understand it, however, I'm afraid that this community will not be able to answer your question meaningfully since it seems that the function has been more or less abandoned, so I took your opportunity to make the connection the fact that the same annoying problem persists even in more recent versions of Mathematica. (+1) $\endgroup$
    – MarcoB
    Oct 19, 2015 at 3:22
  • 2
    $\begingroup$ I'm frustrated about AbsoluteOptions, too - but have to agree with @MarcoB that this appears to be a dead horse (or perhaps a deceased parrot). $\endgroup$
    – Jens
    Oct 19, 2015 at 4:30

1 Answer 1

5
$\begingroup$

OK, seems that Mr.Wizard is busy these years, so let me answer the question myself.

In v13.0 AbsoluteOptions is finally updated, and the problem in the question no longer exists:

enter image description here

If you're in earlier versions, then the undocumented function mentioned here can be used to circumvent the problem:

p1 = Plot[Sin[x], {x, 0, 4}]

ticks = Charting`FindTicks[{0, 1}, {0, 1}] @@@ PlotRange@p1;

p2 = Plot[Sin[x], {x, 0, 4}, Ticks -> ticks]

enter image description here

Oops… the style of 1. is still undesired, but this seems to be a bug in v9.0.1, and doesn't exist at least in v12.3.1.

$\endgroup$
2
  • $\begingroup$ It doesn't work with LogPlot. Do you know why? My MMA is 13.1 $\endgroup$
    – LEO
    Aug 13, 2022 at 0:23
  • $\begingroup$ @LEO Looks like a bug. I suggest reporting it to WRI. It's not hard to fix, though: p1 = LogPlot[Sin[x], {x, 0, 4}]; option = First@AbsoluteOptions[p1, Ticks] /. a_FormBox :> ToExpression@a; Plot[Sin[x] // Log, {x, 0, 4}, Evaluate@option, PlotRange -> {-3.5, 0}, AxesOrigin -> {0, -3.5}] $\endgroup$
    – xzczd
    Aug 13, 2022 at 3:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.