In an experiment, blood pressure is measured at several time points. Blood pressure rises and declines during the experiment. I need to plot the blood pressure reaction (the easy part) and find the time points (x values) where blood pressure has doubled (the tricky part). I was wondering whether this information could be retrieved in the ggplot?
Here is an example:
# Generate data
time <- c(10, 60, 90, 200, 260, 300, 700)
value <- c(1, 6, 8, 40, 50, 60, 70)
df <- data.frame(time, value)
# The first value of "value" is the first observation.
# When the first "value" increased ten times, it is equal to 10
# Question is at what time point did the value increase ten times according to the graph?
ggplot(data=c, aes(x=time, y=value,)) +
geom_line() +
geom_hline(y=10, colour="red") +
annotate("text", hjust=0, x=170, y=15, label="I need to find the x value at the intersection")
Any solutions?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…