library(ggplot2)
library(data.table)
ka_c=0.75
hill <- function(l, n=1, ka=ka_c){
1 / (1 + (ka/l)^n)
}
ligand_conc = c(0, exp(seq(log(0.001), log(1.75), by=0.01)))
data <- rbind(data.table(ligand_conc, fraction=hill(ligand_conc, 0.2), n=0.2),
data.table(ligand_conc, fraction=hill(ligand_conc, 0.5), n=0.5),
data.table(ligand_conc, fraction=hill(ligand_conc, 1), n=1),
data.table(ligand_conc, fraction=hill(ligand_conc, 2), n=2),
data.table(ligand_conc, fraction=hill(ligand_conc, 4), n=4))
svg(height=3, width=5)
ggplot(data, aes(ligand_conc, fraction, colour=forcats::fct_reorder2(as.factor(n), ligand_conc, fraction), group=n)) +
geom_line(data = data.table(ligand_conc=c(0.001, ka_c, ka_c), fraction=c(0.5,0.5,0), n=NA), colour="blue", linetype="dashed") +
annotate("text", x = ka_c*1.1, y = 0.1, label = expression(italic(K[A])), colour="blue") +
geom_line(size=1) +
coord_cartesian(xlim = c(-0.01,1.75), ylim = c(-0.01, 1), expand=F) +
scale_colour_manual(values = c("black","#BD0026","#F03B20","#FD8D3C","#FECC5C"), name="Hill\nCoefficient") +
ylab("Fraction of receptor bound by ligand") +
xlab("Free Ligand Concentration") +
theme_classic()
dev.off()