Skip to content

Instantly share code, notes, and snippets.

@jaspervdj
Created August 16, 2011 06:39
Show Gist options
  • Save jaspervdj/1148549 to your computer and use it in GitHub Desktop.
Save jaspervdj/1148549 to your computer and use it in GitHub Desktop.
Procentual change R plot for the means in two Criterion-produced CSV files
# Read CSV files
v1 <- read.csv(file="s.csv", header=T)
v2 <- read.csv(file="rs.csv", header=T)
# Get result means
m1 <- v1$Mean
m2 <- v2$Mean
# Calculate procentual change
d <- (m2 - m1) * 100 / m1
# Obtain min and max values
bounds <- c(min(d), max(d))
# Set output device
pdf("results.pdf")
# Make label text perpendicular to axis
par(las=2)
# Increase left margin
par(mar=c(5, 14, 4, 2))
# Plot!
barplot(d, names.arg=v1$Name, horiz=T, xlim=bounds)
# Close device
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment