Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Why is Mathematica plotting a horizontal line at $y=2$ in the following example:



How to get rid of this line?

share|improve this question
Try restarting your kernel. It doesn't plot a line like that for me. If the problems persist, please tell us what operating system and version of Mathematica you are using. – C. E. Sep 12 '13 at 14:08
@Anon It does in Mathematica 7 but it doesn't in newer versions. – Artes Sep 12 '13 at 14:09
Does including Axes -> {False, True} or AxesOrigin -> {0, 0} have the desired effect (I am using Mma 7)? – user 106 Sep 12 '13 at 14:15
@TomD Sounds like you should turn that into an answer. – Szabolcs Sep 12 '13 at 14:26
@TomD is correct, but it is much simpler to use Axes -> False since I doubt you want the y-axis. However, there are plots I've made where both frame and axes are used. – rcollyer Sep 12 '13 at 14:39
up vote 5 down vote accepted

Ok, I don't know why no one is answering but we are being flooded by unanswered questions so I'm posting this.

What you are observing is the $x$ axis, it is not the GridLine so Axes->False is the fix. Or rather it is what you have missed because by default Axes->True and it was just a coincidence that it was observed only for V7 users.

The reason why others do not see this in newer versions is only this that the Automatic AxesOrigin is generated in different place.

To reproduce this behaviour in V9 other simply need to add this:

ListPlot[Table[i, {i, 1, 10}], Frame -> True, GridLines -> None, 
                               AxesOrigin -> {0, 2}]

enter image description here

$y$ axis is overlayed by Frame so it is "not" visible.

It could be quite confusing because with Frame->True you can't put Ticks on axes so single line do not look like and axis at all.

Even if one set FrameTicks->None... interesting, but it is different issue so let's not talk about it here.

ListPlot[Table[i, {i, 1, 10}], Frame -> True, GridLines -> None, 
                               FrameTicks -> None, AxesOrigin -> {2, 2}, 
                               Ticks -> True]

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.