I am trying to place an image behind my plot. Currently it is not sitting between the 0,0 and the 120,200 coordinates where I intend it to be. The plot is made using 'sequence()' and line vectors. This is what it looks like right now: Image behind plot.
Here is my code:
library(oro.dicom)
x1 = seq(0, 120, 2)
x3 = seq(2, 122, 2)
x4 = x3
y1 = rep(0, 61)
x2 = x1
y2 = c(runif(60) * 100)
a1 = x1
a3 = x3
b1 = rep(200, 61)
b2 = 200:130
dcmImages <<- readDICOM("/home/ishaan/Desktop/project/data/dcm/imx-000.dcm", verbose = TRUE,
recursive = FALSE, exclude = "sql")
image(t(dcmImages$img[[1]]), col = grey(0:64/64), axes = FALSE)
par(new = TRUE, usr = c(0, 122, 0, 208))
plot(NA, xlim = c(0, 122), ylim = c(0, 200), axes = FALSE)
segments(x1, y1, x2, y2)
segments(x3, y1, x3, y2)
segments(x2, y2, x3, y2)
# ==============================
y2 = c(runif(60) * 100)
yy1 = 200 - y1
yy2 = 200 - y2
segments(x1, yy1, x2, yy2)
segments(x3, yy1, x3, yy2)
segments(x2, yy2, x3, yy2)
Thanks!