Plot two graphs on one plot. function lines does not work

前端 未结 1 1885
野趣味
野趣味 2021-01-05 10:33

I want to plot two graphs on one plot. I read this post, but function lines does not work, nothing happens. I don\'t know what can be the problem. Any ideas?

相关标签:
1条回答
  • 2021-01-05 11:07

    It "doesn't work" because the y-limits do not include the range of the second vector.

     plot(tst_error, type='l', ylim=range( c(tst_error, tr_error) ) )
     lines(tr_error, type='l', col='red')
    

    It's not going to be a particularly interesting plot since the scale of the two vectors are so different. The red line's going to look like a completely flat line.

    0 讨论(0)
提交回复
热议问题