9
$\begingroup$

Bug introduced in 11.3 or earlier and fixed on 12.0.


For a while I have been using the same code to make figures with tick marks pointing out from the axes away from the center of the figure.

Recently I noticed that in my upgrade to version 11.3, the same code failed and now the tick marks began to cross the frame axis. Here is an example:

Image showing problem

I cannot seem to fudge the numbers to get the tick to match the axis frame. It is always either always just past or too long. Here is the code I am using currently.

ListPlot[{0.5, 0.5}, PlotRange -> {{0, 1}, {0, 1}}, 
 FrameTicksStyle -> Directive[{Black, Thick}]
 , Frame -> True
 , Joined -> False
 , AspectRatio -> 1
 , FrameStyle -> Thick
 , Axes -> False
 , BaseStyle -> {25, FontFamily -> "Arial"}
 , FrameLabel -> {Style["x", Black, 25, FontFamily -> "Arial"], 
   Rotate[Style["y", Black, 25, FontFamily -> "Arial"], -(Pi/2)]}, 
 FrameTicks -> {{Table[{0.2 i, 
      If[Round[i] == i, PaddedForm[0.2 i, {2, 1}], ""], {0, 
       If[Round[i] == i, 0.05, 0.025]}}, {i, 0, 10, 0.5}], 
    None}, {Table[{0.2 i, 
      If[Round[i] == i, PaddedForm[0.2 i, {2, 1}], ""], {0, 
       If[Round[i] == i, 0.05, 0.025]}}, {i, 0, 10, 0.5}], None}}]

Please help. Note I am using a MacOS High Sierra Version 10.13.5 ...

$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Jun 23 '18 at 20:35
  • 3
    $\begingroup$ I reproduce the issue with version 11.3 on Windows 7 x64, no problem with version 8.0.4. This is certainly a bug, please report it to support@wolfram.com. $\endgroup$ – Alexey Popkov Jun 24 '18 at 5:24
  • $\begingroup$ Works for me in 12.0 on Mac. $\endgroup$ – kirma Apr 17 at 9:02
  • $\begingroup$ It seems the bug is fixed in version 12.0. I still reproduce the bug in version 11.3, but not in 12.0 on Windows 7 x64. $\endgroup$ – Alexey Popkov Aug 22 at 8:49
4
$\begingroup$

This is certainly a bug, please report to the tech support. Below are some comments and a workaround which I've found when playing with the Manipulate from the answer by Alexei Boulbitch (everything is checked with version 11.3 on Windows 7 x64).

At first, I should note that the presence or absence of the described issue depends on Magnification.

What is more important, the bug disappears if instead of positive value for tick length in the negative direction you specify negative value for tick length in the positive direction:

ListPlot[{0.5, 0.5}, PlotRange -> {{0, 1}, {0, 1}}, 
 FrameTicksStyle -> Directive[{Black, Thick}], Frame -> True, 
 Joined -> False, AspectRatio -> 1, FrameStyle -> Thick, 
 Axes -> False, BaseStyle -> {25, FontFamily -> "Arial"}, 
 FrameLabel -> {Style["x", Black, 25, FontFamily -> "Arial"], 
   Rotate[Style["y", Black, 25, FontFamily -> "Arial"], -(Pi/2)]}, 
 FrameTicks -> {{Table[{0.2 i, 
      If[Round[i] == i, PaddedForm[0.2 i, {2, 1}], 
       ""], {-If[Round[i] == i, 0.05, 0.025], 0}}, {i, 0, 10, 0.5}], 
    None}, {Table[{0.2 i, 
      If[Round[i] == i, PaddedForm[0.2 i, {2, 1}], 
       ""], {-If[Round[i] == i, 0.05, 0.025], 0}}, {i, 0, 10, 0.5}], 
    None}}]

output

Now we have a problem with incorrect distances of tick labels from the axes. We can fix them as follows:

ListPlot[{0.5, 0.5}, PlotRange -> {{0, 1}, {0, 1}}, 
 FrameTicksStyle -> Directive[{Black, Thick}], Frame -> True, 
 Joined -> False, AspectRatio -> 1, FrameStyle -> Thick, 
 Axes -> False, BaseStyle -> {25, FontFamily -> "Arial"}, 
 FrameLabel -> {Style["x", Black, 25, FontFamily -> "Arial"], 
   Rotate[Style["y", Black, 25, FontFamily -> "Arial"], -(Pi/2)]}, 
 FrameTicks -> {{Table[{0.2 i, 
      If[Round[i] == i, Row[{PaddedForm[0.2 i, {2, 1}], Spacer[12]}], 
       ""], {-If[Round[i] == i, 0.05, 0.025], 0}}, {i, 0, 10, 0.5}], 
    None}, {Table[{0.2 i, 
      If[Round[i] == i, 
       Grid[{{PaddedForm[0.2 i, {2, 1}]}}, 
        BaselinePosition -> Scaled[.6]], 
       ""], {-If[Round[i] == i, 0.05, 0.025], 0}}, {i, 0, 10, 0.5}], 
    None}}]

output

$\endgroup$
1
$\begingroup$

Try to play with this:

Manipulate[
 Plot[Cos[x], {x, 0, 10}, Frame -> True, 
  FrameTicks -> {{{0, 0 \[Degree], {a, b}}, {Pi, 
      180 \[Degree], {a, b}}, {2 Pi, 360 \[Degree], {a, b}}, {3 Pi, 
      540 \[Degree], {a, b}}}, {-1/2, 1/2}}], {a, -0.05, 
  0.05}, {b, -0.05, 0.05}, SaveDefinitions -> True]

enter image description here

and choose the values of a and b that best fit your aim.

Have fun!

$\endgroup$

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.