Re: [R] problem with the behaviour of dashed lines in R plots

2017-12-04 Thread Duncan Mackay
boun...@r-project.org] On Behalf Of jean-philippe Sent: Tuesday, 5 December 2017 04:14 To: R mailing list Subject: [R] problem with the behaviour of dashed lines in R plots dear R users, I am performing a linear regression with lm, and I would like to plot the regressor in dashed lines. I know that the

Re: [R] problem with the behaviour of dashed lines in R plots

2017-12-04 Thread Eric Berger
Hi, Sarah's last comment about using min/max x got me thinking. It's not that the points are "very close together", it's that the x-values are not ordered. So the plot is actually drawing a dashed line back-and-forth between different points on the line, which has the effect of making the result ap

Re: [R] problem with the behaviour of dashed lines in R plots

2017-12-04 Thread jean-philippe
hi Sarah, Thanks a lot for having taken time to answer me and for your reply. I wonder how I missed this solution. Indeed plotting the line with the 2 extreme data points works perfectly. Best, Jean-Philippe Fontaine On 04/12/2017 18:30, Sarah Goslee wrote: It's because you are plottin

Re: [R] problem with the behaviour of dashed lines in R plots

2017-12-04 Thread Sarah Goslee
Hi, It's because you are plotting a line between each of the points in your data frame, and they are very close together: > cbind(df1$B,predict(regressor,df1)) [,1] [,2] 1 1.410832 -13.96466 2 1.589383 -15.21169 3 1.446662 -14.21491 4 1.488665 -14.50826 5 1.487035 -14.49687 6 1.

[R] problem with the behaviour of dashed lines in R plots

2017-12-04 Thread jean-philippe
dear R users, I am performing a linear regression with lm, and I would like to plot the regressor in dashed lines. I know that the lty=2 option is the way out, but it has a very strange behaviour: the line starts dashed but then the spaces between each dash becomes very tiny and so the line b