如何使用drm包绘制非对数X轴刻度的剂量反应曲线?
如何在drm包绘制剂量反应曲线时使用非对数X轴?
你的数据如下:
> dput(virus_titration) structure(list(virus_volume = c(0L, 5L, 10L, 15L, 20L, 40L), fluorescent_perc = c(0.59, 34.87, 49.79, 70.41, 77.47, 86.88 )), class = "data.frame", row.names = c(NA, -6L))
当前使用的绘图代码:
model <- drm(fluorescent_perc~virus_volume, data=virus_titration, fct=W1.4(names = c("Slope", "Lower Limit", "Upper Limit", "ED50"))) plot(model, xlab="Virus Volume (uL)", ylab="Fluorescent Percentage", type='all',lty=1, lwd=2)
要将X轴从对数刻度改为非对数(线性)刻度,只需在plot()函数中添加log=""参数即可——因为plot.drm()默认会将X轴设为对数刻度(log="x"),通过设置log=""可以关闭这个默认行为:
model <- drm(fluorescent_perc~virus_volume, data=virus_titration, fct=W1.4(names = c("Slope", "Lower Limit", "Upper Limit", "ED50"))) plot(model, xlab="Virus Volume (uL)", ylab="Fluorescent Percentage", type='all', lty=1, lwd=2, log="")
如果需要自定义X轴的刻度点(比如完全匹配你的数据点),可以额外添加xaxis参数来指定显示的刻度:
plot(model, xlab="Virus Volume (uL)", ylab="Fluorescent Percentage", type='all', lty=1, lwd=2, log="", xaxis=list(at=c(0,5,10,15,20,40)))
内容的提问来源于stack exchange,提问作者Ishan Mehta
相关产品推荐
相关产品推荐

