Exporting Bezier curves from R?

217 views Asked by At

Plotting a sine curve with R and saving the output as PDF:

curve(sin, -2*pi, 2*pi, xname = "t")
dev.copy2pdf(file='sine.pdf')

yields a curve that looks pretty smooth at first glance:

enter image description here

However, when zooming in to the PDF, you can see that the curve really consists of a sequence of linear segments:

![enter image description here

Is there any way to export truly smooth line graphics from R as Bezier curves?

![enter image description here

1

There are 1 answers

6
Hong Ooi On

Is there any way to export truly smooth line graphics from R as Bezier curves?

No. However, you can increase the number of segments used to draw the curve, which will have much the same effect:

curve(sin, -2*pi, 2*pi, xname = "t", n=1001)
dev.copy2pdf(file='sine.pdf')

enter image description here

(1200% resolution)