When evaluating this:

Table[n -> NumberLinePlot[{Range[n], Range[n]+.1}], {n, 4}]

we get this output:

enter image description here

Why is it different for n=2? Looks like a bug to me. Is there a workaround ?

This was evaluated with Mathematica 10.1 under Windows 7.

  • 2
    $\begingroup$ I think the $n=2$ case is unique in that the pairs of values are interpreted as the two intervals $[1, 2]$ and $[1.1, 2.1]$. Compare with NumberLinePlot[{ {{1, 2}}, {{1.1, 2.1}} }]. $\endgroup$
    – MarcoB
    Jun 17, 2015 at 15:02

1 Answer 1


As @MarcoB says in the comments this is because the $n=2$ case is being interpreted as a set of two intervals rather than two separate intervals (where "interval" can also mean "points").

Functions like ListLinePlot have an option setting like DataRange -> All | Automatic to distinguish between cases like this but NumberLinePlot does not seem to have anything similar.

However as per the first example in the Scope > Data section of the documentation the solution is to wrap List around the first number line:

Table[NumberLinePlot[{{Range[n]}, Range[n] + 0.1}], {n, 4}]

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.