Belated Gift: Make a Valentine’s Heart with R

February 16, 2013
62 Views

If you haven’t sent your loved one a Valentine’s Day greeting yet, it’s not too late! Thanks to Guillermo Santos who pointed out an R script from Berkeley’s Concepts in Computing with Data course, I created the following Valentine’s Day card for my husband:

If you haven’t sent your loved one a Valentine’s Day greeting yet, it’s not too late! Thanks to Guillermo Santos who pointed out an R script from Berkeley’s Concepts in Computing with Data course, I created the following Valentine’s Day card for my husband:

Valentine
If you want to make one for your loved one, you can use the R code below (which I modified slightly from the original):

# Source: http://statistics.berkeley.edu/classes/s133/heart.r
heart1 = function(name){
  t = seq(0,60,len=100)
  plot(c(-8,8),c(0,20),type='n',axes=FALSE,xlab='',ylab='')
  x = -.01*(-t^2+40*t+1200)*sin(pi*t/180)
  y = .01*(-t^2+40*t+1200)*cos(pi*t/180)
  lines(x,y, lwd=4)
  lines(-x,y, lwd=4)
  text(0,7,"Happy Valentine's Day",col='red',cex=2.5)
  text(0,5.5,name,col='red',cex=2.5)
}

I also sent one of these cute science-themed Valentines cards that I bought on Etsy (guess which one).

You may be interested

IEEE Big Data Conference 2017 to Highlight Challenges, Opportunities
Big Data
65 shares688 views
Big Data
65 shares688 views

IEEE Big Data Conference 2017 to Highlight Challenges, Opportunities

Ryan Kade - June 23, 2017

Since 2013, the Institute of Electrical and Electronics Engineers has held annual big data conferences to highlight changes and opportunities…

10 of the Top Marketing BI Software Options
Business Intelligence
117 shares1,054 views
Business Intelligence
117 shares1,054 views

10 of the Top Marketing BI Software Options

Hayden B. - June 23, 2017

Business can be complicated sometimes. It’s not always easy to keep track of all the data and information we deal…

The Race for 5G Is the Race for Data Dominance
Big Data
80 shares918 views
Big Data
80 shares918 views

The Race for 5G Is the Race for Data Dominance

Daniel Matthews - June 22, 2017

Have you noticed how often the phrase “by the year 2020” comes up? In the tech sphere, many are heralding…