Reputation: 35
I try to draw line graph using R. The lines have been plotted, but the abline
line doesn't show up.
M <- c(1.0,1.5,2.0,2.5,3)
y <- c(0.0466,0.0522,0.0608,0.0629,0.0660)
plot(M, y, type="l", col="red", xlab="sdr",
ylab="simulated type I error rate")
abline(h=c(0.025,0.075),col=4,lty=2)
This is my simple coding for the graph. Any ways to make the line pop out?
Upvotes: 2
Views: 4084
Reputation: 73265
Try this instead:
M <- c(1.0,1.5,2.0,2.5,3)
y <- c(0.0466,0.0522,0.0608,0.0629,0.0660)
plot(M, y, type="l",col="red",xlab="sdr", ylim = c(0.025, 0.075),
ylab="simulated type I error rate")
abline(h=c(0.025,0.075),col=4,lty=2)
by using ylim
.
I would refer you to read my answer for another post: curve() does not add curve to my plot when “add = TRUE” for more about setting ylim
when plotting several objects on a graph.
Upvotes: 4