4
$\begingroup$

Bug introduced in 10.0.0 and fixed in 10.0.1


Version 10:

This works:

  grids[min_, max_] := Table[If[EvenQ[i], {i, Red}, {i, Blue}], 
       {i, Ceiling[min], Floor[max], 1}];
  Plot[Sin[x], {x, -Pi, Pi}, GridLines -> grids]

Mathematica graphics

But when used with LogPlot it gives an error:

LogPlot[x^x, {x, 1, 5}, GridLines -> grids]

Mathematica graphics

$\endgroup$
7
  • $\begingroup$ Nuts; so I can't even use a custom function! :-S $\endgroup$
    – Mr.Wizard
    Jul 12, 2014 at 9:10
  • $\begingroup$ @Mr.Wizard WRI wants to make it really hard not to have nice log spaced gridlines for LogPlot :) $\endgroup$
    – Nasser
    Jul 12, 2014 at 9:11
  • $\begingroup$ Related: (54578) $\endgroup$
    – Mr.Wizard
    Jul 12, 2014 at 9:11
  • $\begingroup$ Related: (4066) $\endgroup$
    – m0nhawk
    Jul 12, 2014 at 9:29
  • 3
    $\begingroup$ I've reported the issue for Wolfram Support, [CASE:1212405]. $\endgroup$
    – m0nhawk
    Jul 12, 2014 at 10:11

1 Answer 1

2
$\begingroup$

For LogPlot and LogLogPlot you need to specify both grids, vertical and horizontal.

grids[min_, max_] := 
  Table[If[EvenQ[i], {i, Red}, {i, Blue}], {i, Ceiling[min], 
    Floor[max], 1}];
LogPlot[x^x, {x, 1, 5}, GridLines -> {grids, Automatic}]

enter image description here

And for {grids, None}:

enter image description here

$\endgroup$
1
  • 2
    $\begingroup$ Interesting observation, but what about grid-lines for the log direction? GridLines -> {grids, grids} does not work. $\endgroup$
    – Mr.Wizard
    Jul 12, 2014 at 9:31

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.