Index: trunk/l10n-support/nn/skript/translation-graph.R =================================================================== --- trunk/l10n-support/nn/skript/translation-graph.R (revision 1559461) +++ trunk/l10n-support/nn/skript/translation-graph.R (revision 1559462) @@ -1,39 +1,39 @@ #!/usr/bin/Rscript --vanilla # Create graph showing which years the translators have been working on the translations. # Uses data from a ‘translation-statistics.dat’ file. Don’t call this script directly; # instead, use the ‘translation-statistics.sh’ script. library(ggplot2) # Load graphing package. people=read.table("translation-statistics.dat", sep="\t", col.names=c("Number","Person","Year")) # Read translations statistics. # Sort graph first by last year the person worked, and then by the first year: people$Person=with(people,reorder(Person,Year,min)) # Second sort key: First year worked. people$Person=with(people,reorder(Person,Year,max)) # First sort key: Last year worked. # Save the plot. # You might want to play around with the ‘type’ and ‘antialias’ arguments to improve the rendering. png("translation-statistics.png", width = 8*max(nchar(as.character(people$Person))) + 40*diff(range(people$Year)), height = 18*(length(unique(people$Person))+2)) # Could have used simply # qplot(Year, Person, data=people, geom="tile") # but let’s instead do some customising # to improve the look of the graph. ggplot(people, aes(x=Year,y=Person,label=Number)) + # Set up the graph. geom_vline(xintercept=seq(min(people$Year)-.5, max(people$Year)+.5), colour="grey90") + # Draw vertical lines for each year. geom_tile() + # Draw the boxes. geom_text(colour="white",size=4) + - scale_x_continuous(breaks=unique(people$Year), # Show labels for *all* the years on the x-axis. + scale_x_continuous(breaks=min(people$Year):max(people$Year), # Show labels for *all* the years on the x-axis. expand=c(0,0)) + # Remove padding on the left and right of the graph. scale_y_discrete(expand=c(0,0))+ # Remove padding on the top and bottom of the graph. xlab(NULL) + ylab(NULL) + # Remove the axis labels. theme_bw(base_size=16) + # Remove the grey background. theme(panel.grid.major=element_blank(), # Remove the default grid lines, tick marks and border. panel.grid.minor=element_blank(), axis.ticks=element_blank(), panel.border=element_blank(), rect=element_blank()) dev.off() # Save the graph.