I have a dataframe i like to plot, but ggplot doesent accept that i put color in AES. Instead of 3 different graphs, i get one graph. I expect 3 different graphs. Can anyone see what i am doing wrong?
df <- data.frame( xNames= c("lisa", "frank", "johnny"),
coef_a = c(20,25,30),
coef_b = c(1,3,5) )
ggplot(data=df, aes(color= xNames) ) +
stat_function( fun = function(x) (df$coef_a*x) /(df$coef_b+x), size=1,linetype =
"dashed")
+ xlim(0, 10)
I expect the graph to look something like this:
ggplot(data = df) +
stat_function( fun = function(x)(20 * x) / (1 + x), size = 1) +
stat_function( fun = function(x)(25 * x) / (3 + x), size = 1) +
stat_function( fun = function(x)(30 * x) / (5 + x), size = 1) +
xlim(0, 10)