- # Start a new plot, set axis limits and labels, and a few other options
- plot(NA, NA, type = "n", xlim = c(0, 6), ylim = c(0, 4),
- main = "Systemic anaphylactic scores",
- xlab = "Serum histamine concentrations",
- ylab = "Systemic anaphylactic\nscores",
- xaxs = "i", yaxs = "i", axes = F,
- mar = c(5, 5, 4, 2) + 0.1,
- mgp = c(2, 1, 0))
- # x axis
- # Following @nuomin's suggestion, in my opinion 0.5, 1.5, 2.5, ...
- # works better than 1, 2, 3, ...
- axis(side = 1, at = c(0:5 + 0.5),
- labels = c("A (+)", "B", "C", "D", "E", "F (-)"),
- pos = 0)
- # y axis
- axis(side = 2, at = c(0:4), las = 1)
- # connect both axes
- abline(h = 0)
- # Sample code to add data from the first group "A (+)"
- points(c(0:3/10 + 0.35), rep(2, times = 4), pch = 25, bg = "black")
- points(0.5, 2.25, pch = 25, bg = "black")
- lines(c(0.1, 0.9), c(2.05, 2.05))
- text(0.5, 3.75, "a")
- # Other data may be added in a similar manner
Result (with sample data only):




雷达卡




京公网安备 11010802022788号







