#!/bin/sh
# This script draws a barplot to visualise the dependant packages of
# med-bio, med-imaging and med-practice over the years.  The data
# are in debian_med_stats.dat

R --no-save <<EOT
library(plotrix)
dmstats <- read.table(file='debian_med_stats.dat', sep = '\t', fill=TRUE, header=TRUE )
# png("dmstats.png", width = 800, height = 600)
# textcolor="yellow" # for the dark background
textcolor="black"
pdf("dmstats1.pdf", width=9, height=7)
par(col.axis=textcolor,col.main=textcolor)
dmstats.mat <- as.matrix(dmstats)[,2:4]
rownames(dmstats.mat) <- dmstats[['Year']]
dmstats.mat <- t(dmstats.mat)

# Larger font
fontsize$default<-20
fontsize$points<-20
fontsize$text<-24

# mycolors=rainbow(3)
mycolors=c("red", "green", "darkorange")           
par(ont.axis=2, font.lab=2)

# barplot(dmstats.mat,beside=TRUE,col=mycolors,legend.text=TRUE)
barplot(dmstats.mat,beside=TRUE,col=mycolors,
        # legend = colnames(dmstats[,2:4]),
        main = "Number of dependencies of selected Debian Med metapackages"
        )
legend(x="topleft", colnames(dmstats[,2:4]),fill=mycolors, inset=0.05,
       text.col=textcolor
      )

EOT
