[Blends-commit] r2629 - in /blends/trunk/team_analysis_tools: author_stats author_stats_9 author_stats_create_graph author_stats_pdf
tille at users.alioth.debian.org
tille at users.alioth.debian.org
Fri Jan 28 17:20:20 UTC 2011
Author: tille
Date: Fri Jan 28 17:20:17 2011
New Revision: 2629
URL: http://svn.debian.org/wsvn/blends/?sc=1&rev=2629
Log:
Make scripts more generic using parameters
Removed:
blends/trunk/team_analysis_tools/author_stats_9
blends/trunk/team_analysis_tools/author_stats_pdf
Modified:
blends/trunk/team_analysis_tools/author_stats
blends/trunk/team_analysis_tools/author_stats_create_graph
Modified: blends/trunk/team_analysis_tools/author_stats
URL: http://svn.debian.org/wsvn/blends/blends/trunk/team_analysis_tools/author_stats?rev=2629&op=diff
==============================================================================
--- blends/trunk/team_analysis_tools/author_stats (original)
+++ blends/trunk/team_analysis_tools/author_stats Fri Jan 28 17:20:17 2011
@@ -3,11 +3,14 @@
# set -x
if [ "$1" = "" ] ; then
- echo "Usage: `basename $0` <listname>"
+ echo "Usage: `basename $0` <listname> [numauthors]"
exit 1
fi
NUM=10
+if [ "$2" -lt $NUM -o "$2" -gt $NUM ] ; then
+ NUM=$2
+fi
NAME=authorstat_"$1"
DATFILE="${NAME}_year.txt"
Modified: blends/trunk/team_analysis_tools/author_stats_create_graph
URL: http://svn.debian.org/wsvn/blends/blends/trunk/team_analysis_tools/author_stats_create_graph?rev=2629&op=diff
==============================================================================
--- blends/trunk/team_analysis_tools/author_stats_create_graph (original)
+++ blends/trunk/team_analysis_tools/author_stats_create_graph Fri Jan 28 17:20:17 2011
@@ -2,8 +2,8 @@
# This script draws a bar plot from a given text file
# parameters: <datafile> <number_of_value_columns> <headline>
-if [ $# -ne 3 ] ; then
- echo "Usage: `basename $0` <datafile> <number_of_value_columns> <headline>"
+if [ $# -lt 3 ] ; then
+ echo "Usage: `basename $0` <datafile> <number_of_value_columns> <headline> [outputformat] [textcolor]"
exit
fi
@@ -21,13 +21,22 @@
NUM=$2
ENDCOL=$((NUM+1))
+OUTPUTFORMAT=png
+if [ "$4" = "pdf" ] ; then
+ OUTPUTFORMAT=pdf
+fi
+
+TEXTCOLOR=black
+if [ "$5" != "" ] ; then
+ TEXTCOLOR=$5
+fi
+
R --no-save >/dev/null <<EOT
library(plotrix)
dmstats <- read.table(file='$DATFILE', sep = '\t', fill=TRUE, header=TRUE )
-# textcolor="yellow"
-textcolor="black"
-# pdf("${NAME}.pdf", fg=textcolor, width=9, height=7)
-png("${NAME}.png", width = 800, height = 600)
+textcolor="$TEXTCOLOR"
+if ( "$OUTPUTFORMAT" == "pdf" ) pdf("${NAME}.pdf", fg=textcolor, width=9, height=7) else png("${NAME}.png", width = 800, height = 600)
+
par(col.axis=textcolor,col.main=textcolor)
dmstats.mat <- as.matrix(dmstats)[,2:$ENDCOL]
rownames(dmstats.mat) <- dmstats[['year']]
More information about the Blends-commit
mailing list