# Little useless-useful R functions – Using xspline to create wacky signatures

**R – TomazTsql**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Nothing short of wacky usage of plot() function with *xspline* to interpolate the points, but still a “parameter” short of Bezier’s curve.

Given two random vectors, you can generate a plot that, *xspline* will smooth out the plot and give it a “signaturey” look.

The function itself is straightforward:

inscrp <- function(rep){ x <- rnorm(rep) y <- rnorm(rep) plot(x,y, pch = 1, col = "white", xaxt='n', yaxt='n', ann=FALSE, frame.plot=FALSE) xspline(x,y, 1, draw = TRUE, col="blue") }

but the results are splendid

Run the following:

par(mfrow = c(2,1)) inscrp(10) inscrp(20) par(mfrow = c(1,1))

And you will get either a signature kind of look or a doctor’s drug prescription. The main point is, both are impossible to read

Adding more points (e.g.: above 50) to *inscrp*() function might result in a Picasso drawing

As always, code is available on the Github in the same Useless_R_function repository. Check Github for future updates.

Happy R-coding and stay healthy!“

**leave a comment**for the author, please follow the link and comment on their blog:

**R – TomazTsql**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.