Hi!

You forgot to invert the slope: a perpendicular of 1/sqrt(2) should be
-sqrt(2).
Also, you should add asp=1 in the plot command to lock the aspect ratio,
otherwise the scale of both X and Y may be different according to the size
of the window:
plot(x=c(-1, 1), y=c(-1, 1),asp=1); abline(a=0, b=1/sqrt(2)); abline(a=0,
b=-sqrt(2))

Miguel


On Mon, Mar 22, 2010 at 11:13 AM, Martin Ivanov <tra...@abv.bg> wrote:

>  Dear R users,
>
> I need to plot to perpendicular straight lines. However, although I set the
> coefficients
> so that the lines are perpendicular, they do not look to be so in the plot.
> Here is a minimal working example:
> plot(x=c(-1, 1), y=c(-1, 1)); abline(a=0, b=1/sqrt(2)); abline(a=0,
> b=-1/sqrt(2))
>
> Please tell me if the same problem is valid by you. I am running R-2.10.1
> on Linux.
>
> Is there a way out of this?
>
> Regards,
>
> Martin
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to