Skip to content

Instantly share code, notes, and snippets.

@nicolamontecchio
Created August 18, 2011 13:23
Show Gist options
  • Select an option

  • Save nicolamontecchio/1154045 to your computer and use it in GitHub Desktop.

Select an option

Save nicolamontecchio/1154045 to your computer and use it in GitHub Desktop.
plot from STDIN with R
#!/usr/bin/Rscript
d <- as.matrix(read.csv2(file("stdin"), header=FALSE, sep=","))
ca <- commandArgs(trailingOnly=TRUE)
pdf(file=ca[1], width=12, height=6)
plot(d[,1:2], type='n')
lines(d)
dev.off()
@nicolamontecchio
Copy link
Author

put this in /usr/bin or something like that; then
cat plotdata.csv | rplot output.pdf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment