Skip to content

Instantly share code, notes, and snippets.

@dfilimon
Created December 6, 2012 22:24
Show Gist options
  • Save dfilimon/4229045 to your computer and use it in GitHub Desktop.
Save dfilimon/4229045 to your computer and use it in GitHub Desktop.
Trying to plot different columns
plot_skm <- function(infile) {
print(infile)
library(package=ggplot2)
skm <- read.table(infile, skip=1)
cur_dev <- dev.cur()
plot_file <- paste(infile, '-numDataPointSeen.png', sep='')
print(plot_file)
png(plot_file)
qplot(1:length(skm[,1]), skm[,1], xlab='numDataPoints',
ylab='numDataPointsSeen', geom=c('point'))
dev.off()
plot_file <- paste(infile, '-estimatedNumClusters.png', sep='')
print(plot_file)
png(plot_file)
qplot(1:length(skm[,2]), skm[,2], xlab='numDataPoints',
ylab='estimatedNumClusters', geom=c('point'))
dev.off()
plot_file <- paste(infile, '-distanceCutoff.png', sep='')
print(plot_file)
png(plot_file)
qplot(1:length(skm[,3]), skm[,3], xlab='numDataPoints',
ylab='distanceCutoff', geom=c('point'))
dev.off()
plot_file <- paste(infile, '-numCentroids.png', sep='')
print(plot_file)
png(plot_file)
qplot(1:length(skm[,4]), skm[,4], xlab='numDataPoints',
ylab='numCentroids', geom=c('point'))
dev.off()
dev.set(cur_dev)
return(skm)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment