I am trying to plot a graph with ggplot. Currently, I am only able to plot with the plot function in R, not ggplot for my .drc results. I want to use ggplot since I already have nice line of code for it and ggplot is more customizable than the plot function in R. my line of code with the .drc fuynction is:
try<-drm(X..bound~Dilution,data=Titration.8.31,Sample,robust="mean",fct=LL.4())
which generates my .drc data. I can then plot this using the plot function which I don't really want to do since I can't really change labels or anything. in ggplot my line of pre-existing code with loess lines of best fit which I want to remove since they drop below zero and replace with my .drc code is :
ggplot(Titration.8.31, aes(x = Dilution, y = `X..bound`)) +
geom_point(size=5,aes(color=Sample,shape=Sample)) +
scale_shape_manual(values=c(0,2,5,8,13,15,16,17,18,19,20,10,9,3)) +
scale_x_continuous(trans = "log10",breaks = trans_breaks("log10", function(x) 10^x),labels = trans_format("log10", math_format(10^.x)), minor_breaks = 10^(seq(0, 7, by = 0.25))) +
labs(x="Antibody Dilution",y="% Cell Binding") +
theme_minimal() +
theme(axis.title.x=element_text(size=22)) +
theme(axis.title.y=element_text(size=22)) +
theme(axis.text=element_text(size=18)) +
scale_color_manual(values=c("dodgerblue2", "#E31A1C", "green4",
"#6A3D9A", "#FF7F00", "black", "gold1", "skyblue2", "palegreen2", "#FDBF6F", "gray70", "maroon", "orchid1", "darkturquoise", "darkorange4", "brown")) +
coord_cartesian(ylim=c(0,100)) +
theme(legend.key.size =unit(1,"in")) +
theme(legend.text=element_text(size=11))`
How do I change this line of code so that my .drc lines can be the new lines of best fit? If I can't use ggplot, how do I change the x axis label in the plot function (which I think this might be easier)?
The data is dput(Titration.8.31)
:
structure(list(Dilution = c(300L, 900L, 2700L, 8100L, 24300L,
72900L, 218700L, 300L, 900L, 2700L, 8100L, 24300L, 72900L, 218700L,
300L, 900L, 2700L, 8100L, 24300L, 72900L, 218700L, 300L, 900L,
2700L, 8100L, 24300L, 72900L, 218700L, 300L, 900L, 2700L, 8100L,
24300L, 72900L, 218700L, 300L, 900L, 2700L, 8100L, 24300L, 72900L,
218700L, 300L, 900L, 2700L, 8100L, 24300L, 72900L, 218700L),
X..bound = c(92.43, 92.95, 92.26, 86.55, 67.49, 21.86, 0.72,
89.57, 87.84, 82.35, 65.84, 24.18, 3.56, 0.32, 91.63, 90.57,
87.22, 77.03, 39.52, 5.39, 1.24, 93.51, 93.56, 90.33, 80.49,
38.97, 4.7, 0.93, 95.37, 94.44, 91.24, 77.74, 28.76, 2.14,
0.15, 0.01, 0, 0, 0, 0, 0, 0, 0.01, 0, 0.01, 0, 0, 0, 0),
Sample = c("CoV77-39 1mer 0DA", "CoV77-39 1mer 0DA", "CoV77-39 1mer 0DA",
"CoV77-39 1mer 0DA", "CoV77-39 1mer 0DA", "CoV77-39 1mer 0DA",
"CoV77-39 1mer 0DA", "CoV77-39 5mer 0DA", "CoV77-39 5mer 0DA",
"CoV77-39 5mer 0DA", "CoV77-39 5mer 0DA", "CoV77-39 5mer 0DA",
"CoV77-39 5mer 0DA", "CoV77-39 5mer 0DA", "CoV77-39 5mer 2DA GGG",
"CoV77-39 5mer 2DA GGG", "CoV77-39 5mer 2DA GGG", "CoV77-39 5mer 2DA GGG",
"CoV77-39 5mer 2DA GGG", "CoV77-39 5mer 2DA GGG", "CoV77-39 5mer 2DA GGG",
"CoV77-39 5mer 2DA GDGDG", "CoV77-39 5mer 2DA GDGDG", "CoV77-39 5mer 2DA GDGDG",
"CoV77-39 5mer 2DA GDGDG", "CoV77-39 5mer 2DA GDGDG", "CoV77-39 5mer 2DA GDGDG",
"CoV77-39 5mer 2DA GDGDG", "CoV77-39 5mer 2DA GDG", "CoV77-39 5mer 2DA GDG",
"CoV77-39 5mer 2DA GDG", "CoV77-39 5mer 2DA GDG", "CoV77-39 5mer 2DA GDG",
"CoV77-39 5mer 2DA GDG", "CoV77-39 5mer 2DA GDG", "CoV77-39 HA",
"CoV77-39 HA", "CoV77-39 HA", "CoV77-39 HA", "CoV77-39 HA",
"CoV77-39 HA", "CoV77-39 HA", "CoV77-39 WT", "CoV77-39 WT",
"CoV77-39 WT", "CoV77-39 WT", "CoV77-39 WT", "CoV77-39 WT",
"CoV77-39 WT")), class = "data.frame", row.names = c(NA,
-49L))
any help is appreciated and very welcome as I am very new to coding :) Thank you in advance for your time!! It is really appreciated as I really am stuck