Speed up plot() function for large dataset

前端 未结 5 1658
旧时难觅i
旧时难觅i 2020-11-29 07:15

I am using plot() for over 1 mln data points and it turns out to be very slow.

Is there any way to improve the speed including programming and hardware

5条回答
  •  时光取名叫无心
    2020-11-29 08:08

    an easy and fast way is to set pch='.' . The performance is shown below

    x=rnorm(10^6)
    > system.time(plot(x))
      user  system elapsed 
      2.87   15.32   18.74 
    > system.time(plot(x,pch=20))
      user  system elapsed 
      3.59   22.20   26.16 
    > system.time(plot(x,pch='.'))
      user  system elapsed 
      1.78    2.26    4.06 
    

提交回复
热议问题