R:abline不会在我的图表中添加线条

时间:2016-05-25 04:11:58

标签: r plot

我尝试使用R绘制折线图。已绘制线条,但$('.port-cat li').on( 'click', function() { $(this).parents('.portfolio_cat').removeClass('current-cat'); // it's working now }); 线未显示。

abline

这是我对图表的简单编码。有什么办法让这条线弹出来?

1 个答案:

答案 0 :(得分:3)

请改为尝试:

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)

使用ylim

我会推荐您阅读我对另一篇文章的回答:curve() does not add curve to my plot when “add = TRUE”了解有关在图表上绘制多个对象时设置ylim的更多信息。