0

Using the R plot function to plot another function, how can I increase the granularity so that the graph looks smooth? I.e. something analogous to seq(by=.001)?

plot(sin, to=100)

plot(sin, to=100) has jagged edges

riQQ
  • 9,878
  • 7
  • 49
  • 66
Zaz
  • 46,476
  • 14
  • 84
  • 101

1 Answers1

2

Try plot(curve(sin, ...)), and then set n= to your desired resolution.

curve(sin, from=0, to=100)         # default, n=101
curve(sin, from=0, to=100, n=1001)

curve with n=101

curve with n=1001

r2evans
  • 141,215
  • 6
  • 77
  • 149
  • I guess it's fair to ask the OP what the function was, as `?curve` suggests this approach for functions, though `curve(epxr,` still draws. – Chris Aug 22 '21 at 01:38