Message-ID: <001CE357-3E7C-4D54-B3ED-AD3D7922F79E@comcast.net>
Date: 2013-01-15T01:01:36Z
From: David Winsemius
Subject: Plotting two graphs on the same figure
In-Reply-To: <7613204121E19B42BAAA5DA32A6FB0C76AF0E5EB@BY2PRD0510MB354.namprd05.prod.outlook.com>
On Jan 14, 2013, at 3:32 PM, Lily Arias Chauca wrote:
>
> I want to add a line that represents the relationship between x and y to a strip chart, I've tried the following functions:
> par(new=TRUE)
> points(x,y)
> lines(x,y)
>
> but nothing works, I get the strip chart but line doesn't show up. Here is my function:
>
> stripchart(hydfin$exp ~ hydfin$alt, vert = TRUE, pch = 1, method = "jitter", jit = 0.05, xlab = "Elevation", ylab = expression(paste(delta^{2}, "H")))
> points(1:3, hydfin.M, pch = 16, cex = 1.5)
> arrows(1:3, hydfin.M, 1:3, hydfin.M + hydfin.se, lwd = 1.5, angle = 90, length = 0.1)
> arrows(1:3, hydfin.M, 1:3, hydfin.M - hydfin.se, lwd = 1.5, angle = 90, length = 0.1)
> par(new=TRUE)
> lines(hydfin$exp, hydfin$alt,type="l",col="red")
You are probably not plotting to the right coordinates. (You are reversing the x and y roles.) Please include the output of dput(head(hydfin))
--
David Winsemius
Alameda, CA, USA