Initial script for bar plotting. Continued line plot script (started in the last commit, but forgot to mention it).
This commit is contained in:
parent
e2903ffac1
commit
5aae58d680
17
plot/bar_plot.r
Executable file
17
plot/bar_plot.r
Executable file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env Rscript
|
||||
|
||||
# Parsing command line arguments:
|
||||
options = commandArgs(trailingOnly = TRUE)
|
||||
filename = options[1]
|
||||
table_header = options[-1]
|
||||
|
||||
# Loading files:
|
||||
table = read.csv(filename, header = FALSE, row.names = length(table_header) + 1) # The last column of the table gives the timestamp, thus the row names
|
||||
|
||||
# Setting up the table so it can be plotted:
|
||||
colnames(table) = table_header
|
||||
# Transposing for bar plotting:
|
||||
table = t(as.matrix(table))
|
||||
|
||||
# Plotting:
|
||||
barplot(table)
|
@ -5,13 +5,15 @@ library(ggplot2)
|
||||
library(reshape2)
|
||||
|
||||
# Parsing command line arguments:
|
||||
options <- commandArgs(trailingOnly = TRUE)
|
||||
options = commandArgs(trailingOnly = TRUE)
|
||||
filename = options[1]
|
||||
table_header = options[-1]
|
||||
|
||||
# Loading files:
|
||||
table = read.csv(options[1], header = FALSE)
|
||||
|
||||
colnames(table) = c("dpkg", "pip", "git", "misc", "timestamp")
|
||||
table = read.csv(filename, header = FALSE)
|
||||
|
||||
# Setting up the table so it can be plotted:
|
||||
colnames(table) = table_header
|
||||
melted_table = melt(table, id.vars = "timestamp", variable.name = "category")
|
||||
|
||||
# Plotting:
|
||||
|
Loading…
Reference in New Issue
Block a user