Skip to content

Instantly share code, notes, and snippets.

@mrquincle
Created March 26, 2020 19:50
Show Gist options
  • Save mrquincle/e00ebd6034a4c565446c07480ab28af6 to your computer and use it in GitHub Desktop.
Save mrquincle/e00ebd6034a4c565446c07480ab28af6 to your computer and use it in GitHub Desktop.
Visualize VI plot
#!/usr/bin/env Rscript
args = commandArgs(trailingOnly=TRUE)
# Make sure the data is properly formatted.
# It should be separated by tabs. It should start with non-white space.
# It should have two columns: x, y.
separator <- '\t'
library(ggplot2)
source("read.octave.R")
if (length(args) < 2) {
stop("Usage: Rscript --vanilla visualize_input.R [input file] [output folder].\n", call.=FALSE)
}
file_in <- args[1]
dir_out <- args[2]
bname <- basename(file_in)
datapoints <- read.table(file_in, sep=separator)
dataframe <- data.frame(
datapoints
)
color <- 1:nrow(datapoints)/nrow(datapoints)
pdf(NULL)
p <- ggplot(data=dataframe, aes(x=V1, y=V2, color=color)) +
geom_point() + xlab("") + ylab("") +
theme(legend.position="none")
bold.text <- element_text(face = "bold")
dir.create(file.path(dir_out), showWarnings = FALSE)
ggsave(file.path(dir_out, paste("show_", bname, ".png", sep="")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment