7
$\begingroup$

I googled this and do not see it. I noticed when I use Ticks -> with GridLines, then the vertical GridLines no longer show up. This is on version 11.01 on windows 7, 64 bit.

I tried the same MWE on 10.4, same PC, and there the vertical lines show up!

Here is MWE. Running on 11.01

Plot[Sin[t], {t, 0, 6 Pi},
 GridLines -> Automatic, GridLinesStyle -> LightGray,
 Ticks -> {Range[0, 6 Pi, Pi], Automatic}]

Here is the output

Mathematica graphics

Now the same thing on 10.4:

Mathematica graphics

You can see that now the vertical lines show up.

Is this a known bug? Is there a workaround? (I did not tag it as bug)

$\endgroup$
1
  • 1
    $\begingroup$ Probably another GridLines bug; you could approach it as I did here: (60108) $\endgroup$
    – Mr.Wizard
    Commented Dec 8, 2016 at 7:04

1 Answer 1

7
$\begingroup$

The difference arises when using Gridlines -> Automatic, so it might be a stretch to consider this a bug, since the behavior when using Automatic isn't necessarily expected to stay the same between versions.

The version 11 behavior might actually be considered superior in this situation -- in version 10, when ticks are specified manually, the Automatic grid lines don't line up with the specified ticks, which looks odd. In version 11 the Automatic grid lines don't print when the ticks are specified manually, which makes a little more sense. Of course the workaround if you want grid lines is to just give the same specification to GridLines as you do to Ticks:

Plot[Sin[t], {t, 0, 6 Pi}, GridLines -> {Range[0, 6 Pi, Pi], Automatic}, 
  GridLinesStyle -> LightGray, Ticks -> {Range[0, 6 Pi, Pi], Automatic}
]

Mathematica graphics

What is odd about the behavior in version 11 is that the Automatic grid lines take their cue from the Ticks even if Frame -> True so that we only see the FrameTicks. For example, here we might expect the vertical grid lines to show and the horizontal grid lines to be suppressed, but it's the other way around:

Plot[Sin[t], {t, 0, 6 Pi}, GridLines -> Automatic, GridLinesStyle -> LightGray, 
  Ticks -> {Range[0, 6 Pi, Pi], Automatic}, Frame -> True, 
  FrameTicks -> {Automatic, Range[0, 1, 1/3]}
]

Mathematica graphics

This makes it seem like the new behavior is unintentional, or if it is intended as a feature, it needs some more work.

$\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.