 <p>I think there is some issues due to <em>incorrect conversion</em> from <em>factor</em> to <em>numeric</em> variable in your data column 2, the following should fix it (not the point 1.5, 5 is not there anymore):</p> <pre><code>data[,2] &lt;- as.numeric(as.character(data[,2])) well &lt;- data1[2] bin &lt;-data1[1] data&lt;-data.frame(bin, well) lines(data, type="p", lwd=2.5, lty=1, col=colors, pch=plotchar, grid()) </code></pre> <p><a href="https://i.stack.imgur.com/JhKpP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JhKpP.png" alt="enter image description here"></a></p>