13

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.

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
  • 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. – kglr May 05 '15 at 08:32
  • @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 – Mr.Wizard May 05 '15 at 08:36
  • There is closely related question somewhere. – Kuba May 05 '15 at 08:47
  • 2
    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) – kglr May 05 '15 at 08:49
  • @kguler Okay that's just plain weird. I still seem to have one case at least that continues not to work: FrameTicks. I updated my question accordingly. Hopefully this remains stable now. – Mr.Wizard May 05 '15 at 08:52
  • 1
    somewhat related: even terser Frame -> {Bottom, Top, Right} works in V9, not in V10.1. – kglr May 05 '15 at 08:57
  • @kguler That works also in v7; if I've seen that before I had forgotten; a shame to learn of it just after it is obsolete! – Mr.Wizard May 05 '15 at 09:02
  • @Kuba I couldn't find it. Please let me know if you do. – Mr.Wizard May 05 '15 at 09:18
  • I don't recall why it was changed, but I think there was a consistency issue. But, I may just be mis-remembering. That said, "good reason" is subjective. :) – rcollyer Jun 24 '15 at 12:20

1 Answers1

14

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.

Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371
Simon Woods
  • 84,945
  • 8
  • 175
  • 324
  • Thank you. Can you comment on the changing behavior I think I observed regarding Frame and FrameStyle? – Mr.Wizard May 05 '15 at 23:06
  • 1
    @Mr.Wizard, I don't recall seeing any problem with Frame and FrameStyle using the flat list syntax. – Simon Woods May 06 '15 at 18:43
  • 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. – Mr.Wizard May 06 '15 at 22:46
  • 1
    In version 8.0.4 there was simpler built-in definition: Visualization`Utilities`FrameTicksQ[{__?Visualization`Utilities`OptionsDump`tickListQ}]:=True. – Alexey Popkov Jun 24 '15 at 07:35