I am having difficulties getting the X-axis labels (dates) to be as needed when plotting from chron The help syntax from chron lists this example: x <- chron(dates = c("02/27/92", "02/27/92", "01/14/92", "02/28/92"), I have activity plots by time on the y-axis and the dates on the x-axis. What I need/want is that the dates remain the same for a give set of data i.e. 10/25/2006 to 03/30/2007 as with some data sets within this time frame there is no activity for all of the dates so each plot has a different set of dates. Below works great but when I try to constrain the dates it crashes... DF <- read.table(textConnection(Lines), header = TRUE, as.is = TRUE) DF$Date <- chron(DF$Date) DF$Time <- times(paste(DF$Time, 0, sep = ":")) at <- c(0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 21, 22, 23, 24) plot(Time ~ Date, DF, ylim = 0:1, yaxt = "n",main= "Centronycteris centralis") axis(2, at/24, lab = paste(at, "00", sep = ":"), las = 1, cex.axis = .7) Thanks to all here on the group, Bruce Miller
Neotropical bat risk assessments
2009-Feb-16 23:11 UTC
[R] Problems with labeling a set X axis in chron plots
I am having difficulties getting the X-axis labels (dates) to be as needed when plotting from chron The help syntax from chron lists this example: x <- chron(dates = c("02/27/92", "02/27/92", "01/14/92", "02/28/92"), I have activity plots by time on the y-axis and the dates on the x-axis. What I need/want is that the dates remain the same for a give set of data i.e. 10/25/2006 to 03/30/2007 as with some data sets within this time frame there is no activity for all of the dates so each plot has a different set of dates. Below works great but when I try to constrain the dates it crashes... DF <- read.table(textConnection(Lines), header = TRUE, as.is = TRUE) DF$Date <- chron(DF$Date) DF$Time <- times(paste(DF$Time, 0, sep = ":")) at <- c(0, 1, 2, 3, 4, 5, 6, 17, 18, 19, 20, 21, 22, 23, 24) plot(Time ~ Date, DF, ylim = 0:1, yaxt = "n",main= "Centronycteris centralis") axis(2, at/24, lab = paste(at, "00", sep = ":"), las = 1, cex.axis = .7) Thanks to all here on the group, Bruce Miller