13
$\begingroup$

In past versions of Mathematica one could use a terse syntax for FrameTicks:

{bottom, left, top, right}

In 10.1 this syntax is no longer recognized requiring the addition of two sets of brackets:

{{left, right}, {bottom, top}}

However it seems that the flat form is still supported by Frame and FrameStyle.* As a fan of terse code I prefer the flat form and I cannot think of a good reason for its removal from FrameTicks. Is this a bug?

An example rendered in 10.0:

Plot[x, {x, 0, 15},
 Frame -> {True, False, True, True}, 
 FrameTicks -> {All, None, None, None},
 FrameStyle -> {Red, Green, Blue, Magenta}]

enter image description here

And rendered in 10.1:

enter image description here

Note that the top and right frame edges have tick marks despite the None specification; FrameTicks -> {All, None, None, None} is effectively ignored.


* It seemed that in initial experimentation Frame and FrameStyle also did not work. After using PlotTheme->"Classic" as suggested by kguler these were observed to work even without the PlotTheme option. kguler seems to have observed something similar so it's possible this actually happened and I'm not just fooling myself.

$\endgroup$
  • $\begingroup$ it seems that frame specs inside PlotTheme is conflicting with the user-provided frame specs: Plot[2 Sin[x] + x, {x, 0, 15}, Frame -> {True, True, False, True}, PlotTheme->"Classic"] works as expected. $\endgroup$ – kglr May 5 '15 at 8:32
  • $\begingroup$ @kguler Now I am very confused; it seems like the "old" syntax is working again in all cases? Maybe this was a localized problem? :-p $\endgroup$ – Mr.Wizard May 5 '15 at 8:36
  • $\begingroup$ There is closely related question somewhere. $\endgroup$ – Kuba May 5 '15 at 8:47
  • 2
    $\begingroup$ Mr. W same here:). First, It didn't work without PlotTheme->"Classic", not it works with or without it. (Version 10.1.0 for Linux x86 (64-bit) (March 24, 2015), on Wolfram Programming Cloud) $\endgroup$ – kglr May 5 '15 at 8:49
  • 1
    $\begingroup$ somewhat related: even terser Frame -> {Bottom, Top, Right} works in V9, not in V10.1. $\endgroup$ – kglr May 5 '15 at 8:57
14
$\begingroup$

I have no idea if the old syntax was removed for a reason, but normal behaviour can be returned with the following workaround:

Unprotect[Visualization`Utilities`FrameTicksQ];
Visualization`Utilities`FrameTicksQ[{
 _?Visualization`Utilities`OptionsDump`tickListQ,
 _?Visualization`Utilities`OptionsDump`tickListQ,
 _?Visualization`Utilities`OptionsDump`tickListQ,
 _?Visualization`Utilities`OptionsDump`tickListQ
}] := True;

Thanks to Mr. Wizard for suggesting the more robust version.

$\endgroup$
  • $\begingroup$ Thank you. Can you comment on the changing behavior I think I observed regarding Frame and FrameStyle? $\endgroup$ – Mr.Wizard May 5 '15 at 23:06
  • 1
    $\begingroup$ @Mr.Wizard, I don't recall seeing any problem with Frame and FrameStyle using the flat list syntax. $\endgroup$ – Simon Woods May 6 '15 at 18:43
  • $\begingroup$ Since this form is still internally supported after modifying FrameTicksQ and since it seems that Frame and FrameStyle still accept it I am going to presume that this was merely removed by accident during routine maintenance and not intentionally deprecated. $\endgroup$ – Mr.Wizard May 6 '15 at 22:46
  • 1
    $\begingroup$ In version 8.0.4 there was simpler built-in definition: Visualization`Utilities`FrameTicksQ[{__?Visualization`Utilities`OptionsDump`tickListQ}]:=True. $\endgroup$ – Alexey Popkov Jun 24 '15 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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