1#!/usr/bin/env Rscript 2 3# Read and transpose (rotate) TSV data from STDIN 4d = read.table(file("stdin"), sep='\t', header=T, check.names=F) 5d = setNames(data.frame(t(d[,-1])), d[,1]) 6 7png("output.png", width=800, height=720, pointsize=18) 8par(mar=c(5.5,5.5,3,3)) 9par(bg = 'gray95') 10 11palette <- 1:length(d) 12 13matplot(0:(length(d[[1]])-1),d, type='l', lty='solid', lwd=5, xlab='Range', ylab='Mean damage/shot', xaxs='i', yaxs='i', ylim=c(floor(min(d)),ceiling(max(d))), axes=F, mgp=c(3.5,0,0), font.lab=2, col.lab='gray10', cex.lab=1.2, col=palette) 14axis(side = 1, tck=-0.08, lwd=0, col='gray65', col.axis='gray10', lwd.ticks=2, mgp=c(0,2,0), font=2) 15axis(side = 2, tck=-0.08, lwd=0, col='gray65', col.axis='gray10', lwd.ticks=2, mgp=c(0,2,0), font=2) 16axis(side = 3, tck=-0.08, lwd=0, col='gray65', col.axis='gray10', lwd.ticks=2, labels=F) 17axis(side = 4, tck=-0.08, lwd=0, col='gray65', col.axis='gray10', lwd.ticks=2, labels=F) 18grid(NULL, NULL, lty = 'solid', lwd=2, col='gray65') 19 20# Repeat plot so grid lines are positioned behind data series 21par(new=T) 22matplot(0:(length(d[[1]])-1),d, type='l', lty='solid', lwd=3, xlab='Range', ylab='Mean damage/shot', xaxs='i', yaxs='i', ylim=c(floor(min(d)),ceiling(max(d))), axes=F, mgp=c(3.5,0,0), font.lab=2, col.lab='gray10', cex.lab=1.2, col=palette) 23 24legend("topright", legend=colnames(d), inset=0.02, lwd=3, bg='gray90', box.lwd=0, text.col='gray10', col=palette) 25