I am trying to solve a similar problem that was addressed here.
I have the following linear function that I want to plot: f(t) = a*t+b
.
The code I use:
library("ggplot2")
data <- read.table(sep=",",
header=T,
text="a,t,b
0.5, 1, 5
0.5, 2, 5
0.5, 3, 5
0.5, 4, 5
0.5, 5, 5")
eq = function(a,t,b){
a*t+b
}
ggplot(data = data, aes(a=a, t=t, b=b)) +
stat_function(fun=eq)
But I still can't get the plot of the function. What am I doing wrong?