An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110807/eabc2289/attachment.pl>
Creating a scatterplot with sequential dates on x-axis?
3 messages · Caitlin Gibbons, Joshua Wiley, Duncan Mackay
Hi Caitlin,
Here are a couple of options for you:
plot(x = seq(from = as.Date("2011-05-01"), to = as.Date("2011-05-30"),
by = "day"),
y = cumsum(runif(30)))
## using a bit of a shortcut
plot(x = as.Date("2011-05-01") + 0:29,
y = cumsum(runif(30)))
Does that do what you want?
Josh
On Sun, Aug 7, 2011 at 5:00 PM, Caitlin <bioprogrammer at gmail.com> wrote:
Hi all. I need to plot 30 values and I'd like the x-axis to have 30 dates values, e.g., 5/1/2011, 5/2/2011, etc. so an observer could see how the values correspond as the month progresses. Is there a convenient function I could use? I considered creating two vectors, x and y, then simply plotting those. Thanks, ~Caitlin ? ? ? ?[[alternative HTML version deleted]]
______________________________________________ R-help at 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.
Joshua Wiley Ph.D. Student, Health Psychology Programmer Analyst II, ATS Statistical Consulting Group University of California, Los Angeles https://joshuawiley.com/
Try
library(lattice)
x = seq(from = as.Date("2011-01-01"), by = "1 month", length = 10)
y = rnorm(10)
xyplot(y~x)
?xyplot
?seq
Regards
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
ARMIDALE NSW 2351
Email: home mackay at northnet.com.au
At 10:00 08/08/2011, you wrote:
Hi all.
I need to plot 30 values and I'd like the x-axis to have 30 dates values,
e.g., 5/1/2011, 5/2/2011, etc. so an observer could see how the values
correspond as the month progresses.
Is there a convenient function I could use? I considered creating two
vectors, x and y, then simply plotting those.
Thanks,
~Caitlin
[[alternative HTML version deleted]]
______________________________________________ R-help at 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.