I would like to rotate the label of a line representing a specific value on a distribution. Please consider the following data as example. It represents the results of a hypothetical test for 1000 students:
e5a <- seq(30, 110, length = 1000)
e5b <- dnorm(e5a, 70, 10)
I draw a plot, and on this plot I would indicate the result of Bob, that is 80:
plot_e5a <- xyplot(e5b ~ e5a,
type = "l",
main = "Bob's score",
panel = function(x, ...){
panel.xyplot(x, ...)
panel.abline(v = c(70, 80), lty = c(1, 2))
panel.text(lab = c("Mean", "Bob"), x = c(70, 80), y = 0.037,
adj = c(0.4, 0), cex = 1.5)
})
I would like to rotate the labels "mean" and "bob" on the two vertical lines of the graph, hence I tried to rotate the text with the argument rot, that I usually use for Lattice plots:
panel.text(lab = c("Mean", "Bob"), x = c(70, 80), y = 0.037,
adj = c(0.4, 0), cex = 1.5, rot = 90)
Unfortunately, it had no effect. I tried las too, without effect.