[chronojump] Added files to generate r-graphs automatically



commit cf9480d7789a66c61488e95a755c653ae88ba000
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Aug 18 17:54:12 2009 +0200

    Added files to generate r-graphs automatically

 .../r-sqlite/howto_r-sqlite_scripts.txt            |   42 ++++++++++++++++++++
 chronojump_server/r-sqlite/r-sqlite_script_1.txt   |   12 ++++++
 2 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/chronojump_server/r-sqlite/howto_r-sqlite_scripts.txt b/chronojump_server/r-sqlite/howto_r-sqlite_scripts.txt
new file mode 100644
index 0000000..d2336da
--- /dev/null
+++ b/chronojump_server/r-sqlite/howto_r-sqlite_scripts.txt
@@ -0,0 +1,42 @@
+R CMD BATCH r-sqlite_script_1.txt
+generate PDF:
+Rplots.pdf
+------
+png(filename = "Rplot1.png", width = 480, height = 480, units = "px", pointsize = 12, bg = "white", res = NA)
+pie(countriesCount$rep, labels=countriesCount$name, cex=1)
+dev.off()
+
+dev.off() creates the file
+
+problem, needs X11, not usable for server
+
+---- SOLUTION
+installed GDD
+install.packages("GDD")
+
+in order to compile, on server, needed to update R to 2.7.1-lenny, install ttf-freefont (nice fonts), libgd2-noxpm-dev, libpng12-dev
+
+with the ttf-freefont, done links of ttf fonts to
+/usr/local/lib/R/site-library/GDD/fonts
+
+and done in ls /usr/local/lib/R/site-library/GDD/fonts/basefont.mapping
+#--- add your section here if you have some nice TTFs ---
+base.norm:FreeSans.ttf
+base.ital:FreeSansOblique.ttf
+base.bold:FreeSansBold.ttf
+base.bita:FreeSansBoldOblique.ttf
+
+execute R
+> library(GDD)
+> .GDD.font()
+[1] "/usr/local/lib/R/site-library/GDD/fonts/FreeSans.ttf"           
+[2] "/usr/local/lib/R/site-library/GDD/fonts/FreeSansBold.ttf"       
+[3] "/usr/local/lib/R/site-library/GDD/fonts/FreeSansOblique.ttf"    
+[4] "/usr/local/lib/R/site-library/GDD/fonts/FreeSansBoldOblique.ttf"
+[5] NA       
+
+USAGE:
+R CMD BATCH r-sqlite_script_1.txt
+copy file to image dir
+
+see now how to do the small image without calling the script two times (because width and height change can make that the title doesn't fit)
diff --git a/chronojump_server/r-sqlite/r-sqlite_script_1.txt b/chronojump_server/r-sqlite/r-sqlite_script_1.txt
new file mode 100644
index 0000000..6aa7bc2
--- /dev/null
+++ b/chronojump_server/r-sqlite/r-sqlite_script_1.txt
@@ -0,0 +1,12 @@
+library(GDD)
+GDD(file="server_heights_by_sex.png", type="png", w=670, h=400)
+library(RSQLite)
+drv = dbDriver("SQLite")
+file = "/home/xavier/.local/share/Chronojump/database/chronojump.db"
+con = dbConnect(drv, file)
+jumps <- dbGetQuery(con, "select jump.*, person.sex as personsex from jump, person where type='Free' AND simulated >= 0 and jump.personID=person.UniqueID AND sessionID=14")
+stripchart(jumps$tv ~ jumps$personsex, method="jitter", pch=3, jitter=.2, group.names=c("Females","Males"), xlab="Flight time")
+title(main="Free jump heights in sport science students and sex", sub="15 Aug 2009", cex.sub=0.75, font.sub=3, col.sub="red")
+dev.off()
+
+



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]