# cuRve stitching

**You Know**, 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.

Remember curve stitching from grade school? It makes for a nice tutorial for working with some common R functionality.

pkg <- c(“ggplot2″,”reshape2″,”RColorBrewer”)

inst <- pkg %in% installed.packages()

if(length(pkg[!inst]) > 0) install.packages(pkg[!inst],repos=”http://cran.rstudio.com/”)

lapply(pkg,require,character.only=TRUE)

rm(list=c(“pkg”,”inst”))

n <- 50

m1 <- data.frame(x=c(rep(0,n),seq(n,1,-1)),

y=c(seq(1,n,1),rep(0,n)),

group=rep(seq(1,n,1),2))

p1 <- ggplot(data=m1,aes(x=x,y=y,group=group,color=factor(group))) +

scale_color_manual(values=rep(brewer.pal(8,”Dark2″),times=n*2)) +

geom_line(size=1.0) +

theme(legend.position=”none”,

axis.title=element_blank(),

panel.grid=element_blank(),

axis.text=element_blank(),

axis.ticks=element_blank())

p1

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

**You Know**.

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.