gnrlBezierPoints | R Documentation |
This is a general form of bezier line that can be used for cubic, quadratic, and more advanced Bézier lines.
gnrlBezierPoints(ctrl_points, length_out = 100L)
ctrl_points |
The ctrl_points for the bezier control points. This should
either be a |
length_out |
The length of the return points, i.e. how fine detailed the points should be. |
library(grid)
grid.newpage()
l <- gnrlBezierPoints(data.frame(x = c(.1, -.1, .7, 1, 1, 0.1),
y = c(.9, 0, 1, .8, .4, .1)),
length_out = 100)
grid.lines(l[,1], l[,2], gp=gpar(col="#550000", lwd = 4))
out_sizes <- 4:20
clrs <- colorRampPalette(c("orange", "darkblue"))(length(out_sizes))
for (i in out_sizes){
l <- gnrlBezierPoints(data.frame(x = c(.1, -.1, .7, 1, 1, 0.1),
y = c(.9, 0, 1, .8, .4, .1)),
length_out = i)
grid.lines(l[,1], l[,2],
gp=gpar(col=clrs[which(i == out_sizes)]))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.