The Latest

Sep 17, 2012 / 2 notes

R and colors from another dimension

I like to have a "x vs. y"- plot in which the symbol colors represent a additional (or another :-) dimension z.

I’m sure that there are several ways to do that, however here is the way I understand.

Assume that x, y and z have the same length n :

    n <- length(y)

At first I generate a vector from z (z will give the color) in the interval [0,1]

     zp   <- z - min(z)    ## zp starts from 0
     zpp <- zp/max(zp)  ## zpp ends at 1

If I now multiply zpp by n I get a nice index vector which can be used together with the result produced by colorRampPalette():

     cf <- colorRampPalette(c("blue","yellow","red"))

cf is a function. It’s argument is the length of the color vector which should be returned. Now put everything together:


Here is a complete example:

This is how it looks like:


Dec 6, 2011 / 4 notes


Today I searched an old post. I used the tumblr search without success …

So I’ve started a new blog with some couchdb, git, node.js stuff I wrote last months. This kind of posts I will dump there.

Leave a comment on


or do it here. The blog is hosted on


It’s a couchapp. Comments?

I relay hope Wittgenstein will approve.

Nov 29, 2011 / 2 notes
(via Random art on the web «&#160;Statisfaction)
Oct 18, 2011 / 30 notes
Oct 18, 2011 / 10 notes

Colors in R


One of my favorite R packages that I use all the time is the RColorBrewer package. The package has been around for a while now and is written/maintained by Erich Neuwirth. The guts of the package are based on Cynthia Brewer’s very cool work on the use of color in cartography (check out the colorbrewer web site).

As a side note, I think the ability to manipulate colors in plots/graphs/maps is one of R’s many great strengths. My personal experience is that getting the right color scheme can make a difference in how data are perceived in a plot.

Read More

Oct 18, 2011 / 37 notes


generates regExp from nobrainer * expressions

> glob2rx("foo*.bar.*baz")
[1] "^foo.*\\.bar\\..*baz$"
Oct 17, 2011 / 28 notes
Oct 13, 2011 / 7 notes
Oct 11, 2011 / 24 notes


 checking for gcc... gcc                     
 checking whether the C compiler works... yes
 checking for C compiler default output file name... a.out
 checking for suffix of executables...                    
 checking whether we are cross compiling... no            
 checking for suffix of object files... o                 
 checking whether we are using the GNU C compiler... yes  
 checking whether gcc accepts -g... yes                   
 checking for gcc option to accept ISO C89... none needed 
 USE_LOCAL = ""                                           
 Using local libjson code. Copying files                  
 configure: creating ./config.status                      
 config.status: creating src/Makevars                     
 config.status: creating cleanup                          
 ** libs                                                  
 gcc -std=gnu99 -I/usr/lib/R/include -I. ....

 make: g++: Kommando nicht gefunden
 make: *** [JSONChildren.o] Fehler 127            
 ERROR: compilation failed for package ‘RJSONIO’  


 # ln -s g++-4.4 g++                                      
 # l g++                                                  
 lrwxrwxrwx 1 root root 7 11. Okt 13:09 g++ -> g++-4.4*
Oct 6, 2011 / 8 notes
Oct 6, 2011 / 4 notes
Sep 30, 2011 / 22 notes
Sep 28, 2011 / 15 notes
Sep 28, 2011 / 14 notes