Monday, August 16, 2010

All good things...

Here's a summary of my GSoC activity since the mid-term:

The plan for the last month or so was to work on support for R's plotting devices.

Since there's very little documentation for extending R, at first I spent a lot of time reading the code, fiddling with existing graphical devices to get an idea how things work. I also read some of the (excellent) docs for Matplotlib. One issue that immediately became apparent is that Matplotlib doesn't yet support Python 3. Thus, that part of code for graphical devices which depends on Matplotlib is in a patch queue for the main RPy2 repository rather than in my fork of RPy2.

I've also ran into all sorts of issues with compiling R (and to some extent Python itself, see for example: http://bugs.python.org/issue7580) under Mac OS X. The reason I couldn't use precompiled packages is that I needed to have debugging symbols enabled to be able to track all the segfaults ;) To get around this problem, I set up a Linux installation to meet my development needs. Finally I got the graphical device code to work without crashing and pass all the unit tests. Unfortunately, it still crashes under Mac OS which I will try and fix as soon as possible.

After that I managed to get basic support for outputting R drawing primitives to Matplotlib canvas. Here's a 3D plot generated with RPy2 onto Matplotlib:




At the same time my mentor an effort to have a single RPy2 both on Python 2 and 3 (not part of the original project proposal). I did some debugging on his initial merge but it's still not perfect. I never quite got the hang of patch queues in Mercurial but it seems that they don't really support versioning in the way ordinary repositories do. So for now, that code resides on my hard drive. We will get this to work soon.

It was fun! I will definitely continue to contribute to RPy.


3 comments:

  1. that's really neat.

    is this also supported in rpy as well as rpy2?

    ReplyDelete
  2. Unfortunately not, RPy is a completely separate codebase.

    ReplyDelete
  3. great work! would you mind sharing your code for helping a Rpy2 and matplotlib novice like me to get started?

    ReplyDelete