Hello,
It may be a very simple question,….but how I can create a hyterisis plot (counter clockwise), for example, drug effect (PD) is observed later (=delayed) than the actual drug concentration (PK), and when PK vs. PD is plotted with line, it shows hysteresis.
Here is a small, toy example. I can create a hyterisis plot with xyplot, but the line is connected with the order of x-variable with ggplot so can’t produce what I want (I want to connect the line with the order of TIME)…..I tried reorder, relevel, but it doesn’t work (or maybe I am doing wrong).
Could anybody help me?
Kaori
#example data
d <- data.frame(ID=rep(1:2, each=10), TIME=rep(c(0,0.5,1,2,4,6,8,12,16,24),2),
PK=c(0,2,6,20,50,40,20,10,5,3,0,1,3,12,30,35,20,5,4,1),
PD=c(100,102,105,110,120,130,160,150,140,135,60,65,70,75,80,95,100,90,85,70))
library(lattice)
xyplot(PD~PK, data=d, type="b", group=ID)

library(ggplot2)
d$ID <- as.factor(d$ID)
ggplot(d, aes(x= PK, y=PD, group=ID, colour=ID)) + geom_line()

Use geom_path() instead of geom_line().
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example:
https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2