На базовом сюжете это выполнимо, но, может быть, оно и не стоит того
lt = list(drug1 = c ( "s1","s2","s3"),
drug2 = c ( "s1","s2"),
drug3 = c ( "s2"))
bc = table(unlist(lt))
bc = bc[order(names(bc))]
m = sapply(sort(unique(unlist(lt))), function(x) sapply(lt, function(y) x %in% y))
margin = 0.25
graphics.off()
plot(1, 1,
xlim = c(1, length(bc)),
ylim = c(0, max(bc) + NROW(m) + margin),
type = "n",
ann = FALSE,
axes = FALSE)
#box()
for (i in seq_along(bc)){
lines(rbind(c(i, 0), c(i, bc[i])), lwd = 8, lend = "butt")
}
for (i in 1:NROW(m)){
for (j in seq_along(bc)){
if (m[i, j]){
points(j, i + max(bc) + margin, cex = 2, lwd = 2)
if (i > 1 & m[max(1, i-1), j]){
lines(rbind(c(j, i - 1 + max(bc) + margin),
c(j, i + max(bc) + margin)))
}
}
}
}
axis(1, at = 1:NCOL(m), labels = colnames(m), las = 1)
# axis(2, at = seq_along(bc), labels = seq_along(bc), las = 1)
axis(2, at = (1:NROW(m))+ max(bc) + margin, labels = row.names(m), las = 1)