Every so often Prof D watches Hans Rosling's TED talk or TV show and thinks to himself, "Barry could do that". And so the other week he said to me, "Could we do graphics like that in R?". Because he only really understands R, and Ben had recently cooked up some interactive R plots using tk widgets. Here's the kind of thing that www.gapminder.org can serve up with their Adobe Flash widget:
Well obviously you could do this in R. Or something like it. But why? On CRAN there's the googleVis package which pumps your data into google's visualisation library and you can do just this kind of chart. Doing it in vanilla R would be painful, and the whole chart would have to be redrawn every time. It's not really designed for it.
Here then is preview number 1.
I'll never have the time to make it as polished as Gapminder or Googlevis, but here is the start of an open-source version of these charts.
Ooh did I say 'open-source'? Anyone want the code?
Monday, 25 July 2011
"Arkestra is an intelligent semantic Django-based CMS for organisations and institutions". Which is seemingly exactly what we want for our department web pages.
The showcase site, Cardiff University's School Of Medicine is rather impressive.
Arkestra is built on Django-CMS, and is open source. So I decided to play around with it. This blog entry will relate my progress. All this work is being done on an Ubuntu 10.04 box.
First, create a new virtualenv and get into it. Install the required packages using pip, and the cutting-edge stuff from source. Some of these packages are necessary for django-cms and Arkestra, and some are just necessary for the Arkestra example. I'm not sure which is which, so I grab everything.
virtualenv --no-site-packages Test . Test/bin/activate cd Test pip install PIL pip install django pip install BeautifulSoup pip install django-typogrify pip install pyquery pip install -e git+http://github.com/stefanfoulis/django-widgetry#egg=django-widgetry pip install django-filer # gets easy-thumbnails, django-mptt pip uninstall -y django-mptt pip install django-cms pip install django-polymorphic pip install django-appmedia pip install -e hg+https://bitbucket.org/spookylukey/semanticeditor#egg=semanticeditor pip install -e git+git://github.com/ojii/django-classy-tags.git#egg=classytags git clone git://github.com/evildmp/Arkestra.git src/arkestra
I tried to do all this with a pip requirements file but failed - the problem seems to be that django-filer will pull in django-mptt, but django-cms can't work with it.
For reference, here's the output of pip freeze telling you what versions of what I have this working with:
BeautifulSoup==3.2.0 Django==1.3 PIL==1.1.7 South==0.7.3 distribute==0.6.10 django-appmedia==1.0.1 -e git://github.com/ojii/django-classy-tags.git@8ad613b3bc0310ba9afb206136cfadbdfa8e6b01#egg=django_classy_tags-dev django-cms==2.1.3 django-filer==0.8.2 django-polymorphic==0.2 django-typogrify==1.2.2 -e git+http://github.com/stefanfoulis/django-widgetry@57bbf529509e805a74b3e8f36e6938bef591e505#egg=django_widgetry-dev easy-thumbnails==1.0-alpha-17 lxml==2.3 parti-all==0.0.7.22 pyquery==1.0 -e hg+https://bitbucket.org/spookylukey/semanticeditor@3a40b4766f32262be2cfe131cf20a19703bfc339#egg=semanticeditor-dev smartypants==18.104.22.168 textile==2.1.5 wsgiref==0.1.2
Config and Run
Head into the arkestra directory that git got for you, and try running the server:
cd src/arkestra/example export PYTHONPATH=.. # to find the arkestra modules python manage.py runserver
It should run, but you will fail to log in because there's no user accounts. Also, the example.db file isn't compatible with the version of django-cms and possibly other packages. So you can move it and run syncdb again:
mv example.db example.db.orig python manage.py syncdb # create db tables, create admin user python manage.py runserver
Now you can log in and create Page objects, and view them on the site. Don't forget to tick the published and navigation boxes if needed. To add content, you add a Text/Layout plugin and put the content in there.
That should stop the 404s.
Loading the Demo Site
Note that there's a JSON-encoded version of the database supplied in example.json. In theory all you need to do is:
python manage.py loaddata example.json
over an empty database and get it all going. But there's those pesky database differences to deal with. I did go through it editing the changes and got it mostly working, but you'll probably want to build your Arkestra site from scratch. Which is what the second movement in this piece will probably be about.