Is it possible to format the x axis, so that days are spaced
proportionately?
i.e. a larger space between 50 & 100, than 0 and 5?
Have not had any luck with axis.POSIXct().
Many thanks
Murray
try <-
structure(list(visit = structure(as.integer(c(1, 2, 3, 4, 5,
1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1,
2, 3, 4, 5)), .Label = c("Screening", "0", "5",
"50", "100"), class c("ordered",
"factor")), group = structure(as.integer(c(2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1)), .Label = c("Placebo", "Treatment"), class =
"factor"),
variable = as.integer(c(11, 10, 13, 19, 32, 10, 15, 16, 21,
25, 10, 15, 16, 19, 25, 11, 10, 15, 14, 13, 14, 15, 14, 19,
18, 9, 9, 14, 15, 16))), .Names = c("visit", "group",
"variable"
), row.names = c("1", "2", "3", "4",
"5", "6", "7", "8", "9",
"10", "11", "12", "13", "14",
"15", "16", "17", "18", "19",
"20",
"21", "22", "23", "24", "25",
"26", "27", "28", "29", "30"),
class = "
data.frame")
try$visit <-
ordered(try$visit,levels=c("Screening","0","5","50","100"))
library(sciplot)
attach(try)
lineplot.CI(visit,variable,group,type = "b",
bty = "n",
pch = 16,
fixed=TRUE,
ylab = "Mean of Variable",
xtick = TRUE,
xlab = "Day",
x.leg = 1, y.leg = 25,
cex.leg = 0.9,
lty = c(1,5)
)
detach(try)
rm(try)
--
Murray Pung
Statistician, Datapharm Australia Pty Ltd
0404 273 283
[[alternative HTML version deleted]]
You will need a numeric axis, not a factor axis, and control of both
the at= and labels= of the axis. Here is an example using your
data and the lattice xyplot function.
try$visit.position <- try$visit
levels(try$visit.position)
levels(try$visit.position)[1] <- -20
levels(try$visit.position)
try$visit.position <- as.numeric(as.character(try$visit.position))
try$visit.position
try$fake.ID <- factor(rep(1:6, rep(5,6)))
xyplot(variable ~ visit.position,
group=interaction(group, fake.ID)[, drop=TRUE],
data=try, type="l",
scales=list(
at=unique(try$visit.position),
labels=levels(try$visit)),
auto.key=TRUE)
xyplot(variable ~ visit.position | group,
group=fake.ID,
data=try, type="l",
scales=list(
at=unique(try$visit.position),
labels=levels(try$visit)),
panel=function(...) {
panel.abline(v=-10, lty=2, col="gray50")
panel.superpose(...)
},
auto.key=TRUE)
I had some trouble with your email. It folded at the
column where you said
class="
data.frame"
and therefore the class was interpreted as "\ndata.frame",
and was not seen as a "data.frame".
I placed a vertical boundary in the plot between the screening time
and the time=0.
Rich