okay, it works with the table but as indicated before it's better with dput()
dput(LC10run123)
LC10run123 = structure(list(time = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 96, 96, 96, 96,
96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
96, 96, 96, 96, 96, 96, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 72, 96, 96, 96,
96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
96, 96, 96, 96, 96, 96, 96, 96), con = c(0, 0, 0, 5, 5, 5, 10,
10, 10, 25, 25, 25, 50, 50, 50, 100, 100, 100, 250, 250, 250,
500, 500, 500, 750, 750, 750, 0, 0, 0, 5, 5, 5, 10, 10, 10, 25,
25, 25, 50, 50, 50, 100, 100, 100, 250, 250, 250, 500, 500, 500,
750, 750, 750, 0, 0, 0, 5, 5, 5, 10, 10, 10, 25, 25, 25, 50,
50, 50, 100, 100, 100, 250, 250, 250, 500, 500, 500, 750, 750,
750, 0, 0, 0, 5, 5, 5, 10, 10, 10, 25, 25, 25, 50, 50, 50, 100,
100, 100, 250, 250, 250, 500, 500, 500, 750, 750, 750, 0, 0,
0, 5, 5, 5, 10, 10, 10, 25, 25, 25, 50, 50, 50, 100, 100, 100,
250, 250, 250, 500, 500, 500, 750, 750, 750, 0, 0, 0, 5, 5, 5,
10, 10, 10, 25, 25, 25, 50, 50, 50, 100, 100, 100, 250, 250,
250, 500, 500, 500, 750, 750, 750, 0, 0, 0, 5, 5, 5, 10, 10,
10, 25, 25, 25, 50, 50, 50, 100, 100, 100, 250, 250, 250, 500,
500, 500, 750, 750, 750, 0, 0, 0, 5, 5, 5, 10, 10, 10, 25, 25,
25, 50, 50, 50, 100, 100, 100, 250, 250, 250, 500, 500, 500,
750, 750, 750, 0, 0, 0, 5, 5, 5, 10, 10, 10, 25, 25, 25, 50,
50, 50, 100, 100, 100, 250, 250, 250, 500, 500, 500, 750, 750,
750, 0, 0, 0, 5, 5, 5, 10, 10, 10, 25, 25, 25, 50, 50, 50, 100,
100, 100, 250, 250, 250, 500, 500, 500, 750, 750, 750), bgrowth = c(0.054077777,
0.0685, 0.026744443, 0.053544443, 0.068288892, 0.025900001, 0.050799998,
0.06631111, 0.02448889, 0.053177776, 0.067511109, 0.025344443,
0.054233333, 0.071433335, 0.0257, 0.055088885, 0.071733333, 0.026511111,
0.05564444, 0.067944443, 0.026433334, 0.058188888, 0.068177779,
0.025955555, 0.056088885, 0.069733334, 0.026511111, 0.635544441,
0.514433345, 0.490211104, 0.854355555, 0.704055555, 0.699011101,
0.859155551, 0.727388886, 0.717944437, 0.873033333, 0.733611114,
0.741766666, 0.875222214, 0.726455557, 0.742722214, 0.87636667,
0.73375555, 0.753133338, 0.874999995, 0.727300002, 0.749855566,
0.869066664, 0.743155553, 0.755233328, 0.861655548, 0.746566667,
0.740066675, 0.745566663, 0.672088886, 0.539477775, 0.916099995,
0.729022223, 0.726077765, 0.89887777, 0.708488893, 0.688611113,
0.904488885, 0.707955564, 0.746277766, 0.898722221, 0.718977787,
0.695800003, 0.907077779, 0.720633333, 0.740911096, 0.909433328,
0.712455556, 0.722533342, 0.908500006, 0.722133343, 0.733944452,
0.905811114, 0.748233337, 0.735788872, 0.763200004, 0.654966658,
0.506355549, 0.882088879, 0.724333325, 0.578622227, 0.864133331,
0.696800006, 0.573511109, 0.879533343, 0.701866659, 0.591622225,
0.875988887, 0.71194444, 0.591133321, 0.867644461, 0.721133337,
0.596522217, 0.870155559, 0.716477784, 0.590666663, 0.876722222,
0.725299993, 0.589766666, 0.87406667, 0.749733321, 0.598522224,
0.774755555, 0.650211121, 0.489066659, 0.858644443, 0.756199994,
0.555111109, 0.834744444, 0.724644447, 0.54858889, 0.84894445,
0.713277775, 0.571344434, 0.838288881, 0.711677781, 0.567144432,
0.843344441, 0.712166665, 0.574666657, 0.832666666, 0.703177782,
0.57164443, 0.832288885, 0.710699994, 0.569555546, 0.828622219,
0.755966662, 0.570777772, 0.054077777, 0.0685, 0.026744443, 0.051088887,
0.071566667, 0.028622222, 0.051411111, 0.070766665, 0.025388888,
0.050644443, 0.067944443, 0.026144444, 0.053177775, 0.068122222,
0.025433333, 0.052988886, 0.066388886, 0.025122223, 0.054533332,
0.065788891, 0.028088888, 0.056088887, 0.066511112, 0.02512222,
0.052677778, 0.070700002, 0.026266667, 0.635544441, 0.514433345,
0.490211104, 0.858433341, 0.72485555, 0.741488881, 0.870144448,
0.751644453, 0.751744457, 0.870411106, 0.737722225, 0.764088896,
0.873577782, 0.716822228, 0.756466668, 0.878266667, 0.728988893,
0.753377783, 0.87857777, 0.719355551, 0.762000005, 0.873522217,
0.715288885, 0.747466671, 0.867288883, 0.749999994, 0.761455557,
0.745566663, 0.672088886, 0.539477775, 0.905388882, 0.728644442,
0.766877787, 0.904688885, 0.719555548, 0.73775554, 0.893633329,
0.711277781, 0.607800004, 0.896177785, 0.697033344, 0.66645555,
0.904966669, 0.703944443, 0.670399987, 0.903588894, 0.681866664,
0.650077777, 0.898488883, 0.678055556, 0.635422213, 0.894688888,
0.725622215, 0.70873335, 0.763200004, 0.654966658, 0.506355549,
0.859622219, 0.705811102, 0.597322224, 0.864322224, 0.697311109,
0.593388887, 0.854033343, 0.693455556, 0.592122215, 0.850200003,
0.683333343, 0.588788892, 0.853500001, 0.692877769, 0.585011103,
0.855922215, 0.682633326, 0.604422217, 0.857988887, 0.680855552,
0.584433329, 0.852044442, 0.729500002, 0.599611109, 0.774755555,
0.650211121, 0.489066659, 0.846777774, 0.708088893, 0.570877769,
0.846611107, 0.693044449, 0.570133327, 0.848066665, 0.683800007,
0.569522227, 0.835011109, 0.673044435, 0.56244444, 0.82808889,
0.679744447, 0.561466666, 0.823666663, 0.666788888, 0.578866666,
0.816311099, 0.675900007, 0.562899998, 0.815122211, 0.732355553,
0.574244445), Purification = c("RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW", "RAW",
"RAW", "RAW", "RAW", "RAW", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR", "PUR",
"PUR", "PUR", "PUR", "PUR"), RhlType = c("C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14", "C14",
"C14", "C14", "C14", "C14", "C14", "C14")), row.names = c(NA,
-270L), class = c("tbl_df", "tbl", "data.frame"))
This can be copied directly into R.
Also your mutatedata and mutatedata2 aren't needed for your example so you can leave this out in the question.
You were nearly there, you just needed to define the colours with "colour = as.factor(con)", the "as.factor" is needed because these are numbers and are interpreted as numbers.
ggplot(mutatedata3,
aes(x = time, y = bgrowth,
# fill = as.factor(con),
colour = as.factor(con) )) +
geom_point() +
geom_smooth(formula = y~x, method=loess ,
se= FALSE,
show.legend = TRUE, span=0.5) +
annotate("text",x=72, y=0.5, hjust=0, label="y~x", size=4)+
facet_wrap(~Purification) +
theme_bw()+
theme(panel.border = element_blank(),
panel.background = element_rect(color = "black"),
strip.background = element_rect(fill = "darkgray"),
strip.text.x = element_text(face="bold", size=12),
legend.title=element_text(face="bold"),
axis.text=element_text(size=12,colour = "black"),
axis.title.y =element_text(size=12,face="bold", margin = margin(r=7)),
axis.title.x =element_text(size=12,face="bold", margin = margin(t=7)),
strip.text = element_text(size=12, face="bold", color="black"))+
scale_color_manual(name = "Concentration",
values = c("0" = "black", "5" = "red", "10"= "purple",
"25"="blue", "50"= "green", "100"= "orange",
"250"= "skyblue", "500"="maroon", "750"="violet"),
aesthetics = "colour" ) +
# or for using with se = TRUE:
# aesthetics = c("fill", "colour" ))+
scale_y_continuous(breaks = seq(0.1,1, by=0.1)) +
scale_x_continuous(breaks= seq(0,96, by=24))
In the geom_smooth the se can be set to false, with the average value there isn't much to show anyway. If you want to keep it you also need to define the fill values (commented out in the example above).
This however might be more interesting when showing the individual values (that have quite big spreads)
ggplot(LC10run123,
aes(x = time, y = bgrowth,
fill = as.factor(con),
colour = as.factor(con) )) +
geom_point() +
geom_smooth(formula = y~x, method=loess ,
se= TRUE,
show.legend = TRUE, span=0.5) +
annotate("text",x=72, y=0.5, hjust=0, label="y~x", size=4)+
facet_grid(Purification ~ con) +
theme_bw()+
theme(legend.position = "none", # hide the legend here
panel.border = element_blank(),
panel.background = element_rect(color = "black"),
strip.background = element_rect(fill = "darkgray"),
strip.text.x = element_text(face="bold", size=12),
legend.title=element_text(face="bold"),
axis.text=element_text(size=12,colour = "black"),
axis.title.y =element_text(size=12,face="bold", margin = margin(r=7)),
axis.title.x =element_text(size=12,face="bold", margin = margin(t=7)),
strip.text = element_text(size=12, face="bold", color="black"))+
scale_color_manual(name = "Concentration",
values = c("0" = "black", "5" = "red", "10"= "purple",
"25"="blue", "50"= "green", "100"= "orange",
"250"= "skyblue", "500"="maroon", "750"="violet"),
aesthetics = c("fill", "colour" ))+
scale_y_continuous(breaks = seq(0.1,1, by=0.1)) +
scale_x_continuous(breaks= seq(0,96, by=24))