S&F Guild Stats

Shakes & Fidget guild stats

The picture above is generated by the following R script.

#!/usr/bin/Rscript
 
# Using GDD since png() requires xlibs which I don't want to install on this server
library(GDD)
GDD(file="sfstats.png", type="png", width=640,height=640, ps=11, bg="white")
 
# Read the stats file which is formatted
stats<-read.table("~/mauconnection")
datum<-as.Date(stats[,3])
punkte<-stats[,2]
platz<-stats[,1]
 
# Prepare the plot: two rows, one column
par(mfrow=c(2,1))
 
# Quick and dirty solution to put five more or less equally distributed dates
# as ticks for the x-axis
ticksdatum<-datum[round(seq(1,length(datum),length=5))]
 
plot(datum
  , punkte
  , pch=16
  , xaxt = "n"
  , type = "l"
  , xlab = "Datum"
  , ylab = "Punkte"
)
axis(1, at=ticksdatum, labels=format(ticksdatum, "%Y-%m-%d"))
 
# Put in a line generated from a linear model to see our trend
myline.fit<-lm(punkte~datum)
abline(myline.fit, col="blue")
 
# Denote our top ranking
max_i<-which.max(punkte)
d_max<-datum[max_i]
p_max<-punkte[max_i]
points(d_max, p_max, col="red", cex=2)
text(d_max, p_max, p_max, pos=4, col="red")
text(d_max, p_max, d_max, pos=2, col="red")
title("Punktestand")
 
plot(datum
  , platz
  , pch = 16
  , xaxt = "n"
  , type = "l"
  , xlab = "Datum"
  , ylab = "Rang"
)
axis(1, at=ticksdatum, labels=format(ticksdatum, "%Y-%m-%d"))
myline.fit<-lm(platz~datum)
abline(myline.fit, col="blue")
min_i<-which.min(platz)
d_min<-datum[min_i]
p_min<-platz[min_i]
points(d_min, p_min, col="red", cex=2)
text(d_min, p_min, p_min, pos=4, col="red")
text(d_min, p_min, d_min, pos=2, col="red")
title("Platzierung in der Rangliste")
dev.off()