Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert a Graph to a Data Frame in R

Tags:

graph

r

So a while back (6 months+) I saw a blog post where the author took a line graph someone had posted on the internet, fed the image into R, and used a function to convert the image into a data frame.

I've looked everywhere, and I can't seem to find this blog post (even though I'm sure I bookmarked it). So I was wondering if any of you had also read said blog post, or if someone knew of a quick and easy way to convert a line graph to a data frame in R?

like image 531
Adam Avatar asked Mar 21 '11 18:03

Adam


1 Answers

Was this it? I searched for "R digitize plot". The package used is "ReadImages". For completeness, the steps listed were (see link):

library(ReadImages) #Load package
mygraph <- read.jpeg('plot.jpg') #Import image
plot(mygraph) # Plot the image
calpoints <- locator(n=4,type='p',pch=4,col='blue',lwd=2) # Calibrate the plot by selecting known coordinates
data <- locator(type='p',pch=1,col='red',lwd=1.2,cex=1.2) # Collect the data points in a dataframe
like image 162
Benjamin Avatar answered Sep 22 '22 23:09

Benjamin