14
$\begingroup$

On my system, Mathematica 10.1.0 under Windows, none of these FrameTicks documentation examples work correctly:

(* Draw frame ticks at the specified positions with the specific labels: *)

Plot[Sin[x], {x, 0, 10}, Frame -> True, 
 FrameTicks -> {{{0, 0 °}, {Pi, 180 °}, {2 Pi, 360 °}, {3 Pi, 
     540 °}}, {-1/2, 1/2}}]


(* Specify frame ticks with scaled lengths: *)

Plot[Cos[x], {x, 0, 10}, Frame -> True, 
 FrameTicks -> {{{Pi, 180 °, {.4, .05}, Red}, {2 Pi, 360 °, {.4, .05}, 
     Thick}, {3 Pi, 540 °, {.4, .05}, Directive[Red, Dashed]}}, {-1, 1}}]


(* Specify frame ticks with scaled lengths in positive and negative directions: *)

Plot[Cos[x], {x, 0, 10}, Frame -> True, 
 FrameTicks -> {{{0, 0 °, {.4, .05}}, {Pi, 180 °, {.4, .05}}, {2 Pi, 
     360 °, {.4, .05}}, {3 Pi, 540 °, {.4, 0.05}}}, {-1/2, 1/2}}]


(* Specify the style of each frame tick: *)

Plot[Cos[x], {x, 0, 10}, Frame -> True, 
 FrameTicks -> {{{Pi, 180 °, {.4, .05}, Red}, {2 Pi, 360 °, {.4, .05}, 
     Thick}, {3 Pi, 540 °, {.4, .05}, Directive[Red, Dashed]}}, {-1, 1}}]

All produce a pink error box with a Tooltip message

enter image description here

Is this indeed a bug or have a broken something in my configuration?

Does it affect other versions and platforms or only 10.1.0 under Windows?


Related:

$\endgroup$
16
  • 2
    $\begingroup$ All broken on 10.1 on Mac Mavericks. All working on Win 7 on 10.0.2 $\endgroup$ Commented Jun 23, 2015 at 9:28
  • 1
    $\begingroup$ None of these are a problem for me using Linux v10.0.0 $\endgroup$
    – JeffDror
    Commented Jun 23, 2015 at 12:16
  • 2
    $\begingroup$ Not a bug, but a deprecated form of the tick specification. $\endgroup$
    – rcollyer
    Commented Jun 23, 2015 at 14:59
  • 1
    $\begingroup$ I would say that rcollyer has provided a convincing argumentation -- somtimes "things change" and we simple humans have to adapt and break with dear habits. ;-) In any case I would suggest to remove the bug tag because Mathematica does behave according to its current documentation. $\endgroup$
    – gwr
    Commented Jun 23, 2015 at 17:19
  • 2
    $\begingroup$ Now the question is, which part of the documentation is incorrect? Are the examples outdated or is the list of possible setting incomplete? $\endgroup$
    – Karsten7
    Commented Jun 23, 2015 at 19:23

2 Answers 2

20
$\begingroup$

This is not a bug, the tick specification used in the documentation is incorrect. The tick specification in these examples is

{bottom, left}

which is the short form of

{bottom, left, top, right}

which was an older tick specification that was deprecated in v7 (according to the docs). But, it was allowed to continue to work until v10. The form you are looking for is

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

or

{{{-1/2, 1/2}, None}, {{{0, 0 °}, {Pi, 180 °}, {2 Pi, 360 °}, {3 Pi, 540 °}}, None}}

which works just fine.

enter image description here

$\endgroup$
0
5
$\begingroup$

I can confirm this bug under Win 7 Mathematica 10.1.0.0.

A workaround for the moment is to specify all FrameTicks, e.g.

Plot[Sin[x], {x, 0, 10}, Frame -> True, 
 FrameTicks -> {ConstantArray[{-1/2, 1/2}, 2], 
                {#, #} &@{{0, 0 °}, {Pi, 180 °}, {2 Pi, 360 °}, {3 Pi, 540 °}}}]

Plot


Three more workarounds that narrow down the problem

Plot[Sin[x], {x, 0, 10}, Frame -> True, 
 FrameTicks -> {{{0, 0}, {Pi, 180}, {2 Pi, 360}, {3 Pi, 540}}, {-1/2, {0, ""}, 1/2}}]

Plot[Sin[x], {x, 0, 10}, Frame -> True, 
     FrameTicks -> {{{0, 0}, {Pi, 180}, {2 Pi, 360}, {3 Pi, 540}}, {-1/2, 1/2, 1/2}}]


Plot[Sin[x], {x, 0, 10}, Frame -> True, 
 FrameTicks -> {{{0, 0}, {Pi, 180}, {2 Pi, 360}, {3 Pi, 540}}, {-1/2, 1/2}}] /. 
Visualization`Utilities`ScaleFrameTicks[l1_List, {xTicks_List, wrong_}] :> 
 Visualization`Utilities`ScaleFrameTicks[l1, {{{-(1/2), 1/2}, {-(1/2), 1/2}}, xTicks}]
$\endgroup$

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.