I am using the drc package to calculate and plot dose response curves. I recently tried to plot curves with control data (i.e. x values of 0), but doing so gives me problems with the x-axis.
Here is some example:
dose <- c(0, 0, 0,
0.03, 0.03, 0.03,
0.08, 0.08, 0.08,
0.25, 0.25, 0.25,
0.75, 0.75, 0.75,
2, 2, 2,
6.67, 6.67, 6.67,
20, 20, 20)
resp <- c(120,122,125,
#create data table with dose and response data
Data <- data.table(dose=dose, resp=resp)
#use drm function of drc package to get curve data (a drm object)
drm <- drm(resp ~ dose, data = Data, fct = llogistic2())
lwd = 5, #curve thickness
col = "blue", #curve color
broken = TRUE, #use breakpoint in x-axis
bp = min(dose[dose!=0]), #breakpoint is supposed to start at second biggest dose
type = 'average', #draw average resp for each unique dose
ylim = c(0, 150), #range of y-axis
cex.main = 2, #title size
cex.lab = 2, #lable size
cex.axis =2 #axis lable size
If I run this code, I get the following plot:
I would like to solve 3 issues:
- The x-axis tick after the axis break is not vertically aligned with the drawn response value (blue point above)
- I would like to add logarithmic ticks between the existing ticks, but without adding any further numbers on the axis.
- Is there a way to use the break and still have the curve starting from the control?
I already tried to achieve these by experimenting with drc.plot() and axis() parameters. Unfortunately, without any satisfying results. So it would be great, if someone can help me out!