I have two raw and coef data frames:
- one containing raw data
- another containing simulation coefficients that I got from raw data.
The first raw data frame contains:
Time (0 to 900 seconds)OD for many options and four runs.
The second coef data frame contains:
- one line per combination of options /
t0.1 with separate coefficients ( M , D.1 and t0.1 ) in this line.
I runID separation of the raw data by options and colored by runID , no problem. But now I want to impose model curves according to runID .
Since simulation coefficients are in different data frames with different dimensions, I cannot just cbind them. stat_function will not work for me. I can only get one curve showing at a time.
I tried with for loop , adding a stat_function layer every time:
p <- ggplot(temp, aes(Time, OD)) + geom_point(aes(colour = runID), size = 2)
At the end, all p returns this plot of the source data and the final curve from the cycle bit. p seems to be reset every time I try to add a new stat_function layer.
Any ideas?
function r plot ggplot2 overlay
Benjaminh
source share