New site - visualizing election results

I have a new site up which graphically displays information about the results of the 2009 South African elections. This project was an exercise in learning to use the D3.js framework. All the code and data is available in a github repository.

Map of electrification from 1996 to 2011

New map I drew this weekend: it shows the spread of electrification in South Africa from 1996 to 2011, based on census data. The actual variable measured is "Main source of energy for lighting". As usual, click for the full-size version.

Home language distribution map

I have added a layer showing the distribution of first/home languages from Census 2011 to my dot distribution map website. Next up: household income.

Zoomable, scrollable racial dot distribution map of South Africa

Following on from the maps described in my previous blog posts, I've now create a zoomable, scrollable dot map showing racial distribution across the whole of South Africa

Comparing 2001 and 2011

For comparison with the 2011 census maps in my previous blog post, I've drawn similar maps based on the 2001 census data. There are two caveats to this: firstly, the 2001 census only made the race data available at a subplace (i.e. suburb) level, although the density is accurate to similar levels as the 2011 maps. Secondly, the 2001 census did not include the response of "Other" to the race question.

Here's Cape Town (2001 first and 2011 second; as before, click for full-size):

 

 

Joburg:

 

Durban:

 

My next long-term project is to turn this type of data into an overlay for Google Maps/OpenStreetMap so that you can scroll around and see how this looks across the whole country.

Dot-maps of racial distribution in South African cities

Inspired by Bill Rankin's "Chicago Boundaries", and having finally obtained a copy of the small-area data from Census 2011, I decided to draw some similar dot-maps showing how the population is distributed in South African cities. The primary lesson from these is that the legacy of apartheid is still very clearly visible. I suppose that was to be expected.

UPDATE: click here for my new post with comparable maps from the 2001 census.

UPDATE 2: click here for a zoomable, scrollable map of the whole country.

In each map, one dot represents 50 people. Here's Cape Town (with all of these, click for a full-size version):

 Johannesburg:

 Durban:

Durban

I've also made maps for Bloemfontein, East London, Port Elizabeth and Pretoria.

Some information about South African redditors

I took a look at the data from the Who in the World is reddit survey to see what it says about South African redditors. Only 83 survey entries listed their country of residence as South Africa, compared to 409 subscribers to /r/southafrica, so this data might not provide a complete picture.

To start off, it will surprise no-one to learn that most SA redditors are men in their twenties and thirties.

Despite the “forever alone” stereotype, just about half are in a relationship.

We’re a pretty well-educated lot, with almost two-thirds having some type of degree. I’m a little curious about the one associate’s degree, since I don’t think such a thing exists in South Africa. Could be an American expat, I suppose.

Income has quite a varied distribution. The original income ranges are given in multiples of US$20 000 — for the sake of having relatively round numbers, I used an exchange rate of seven rand to the dollar.


(And yes, I know this is a bad histogram, but it seems to be impossible to get Libreoffice Calc to draw a better one.)

I didn’t draw a chart of the answers to the “favourite subreddit” question, because the answers were widely varying. The top seven were:

  • /r/fffffffuuuuuuuuuuuu: 8 people
  • /r/askreddit: 7 people
  • /r/pics: 4 people
  • /r/truereddit: 4 people
  • /r/askscience: 3 people
  • /r/iama: 3 people
  • /r/programming: 3 people

(I counted “f7u12” responses towards fffffffuuuuuuuuuuuu.)

Finally, there are the two really serious questions. It turns out that South African redditors are mostly dog people:

But we are a divided nation when it comes to the issue of cheese:

I'm gay

This is not a metaphor for anything. I've been pretending for far too long - I don't really know why. In retrospect, I've known for about eight years, but it's taken this long to accept it for myself; the process of telling others has been quite quick.

To those who feel that I should have told them in person, rather than on my blog or via Facebook, I apologise; this is the way that is easiest for me - I'm not good at talking about my personal life face-to-face, but I can deal with it at the keyboard. I have, of course, already told my parents, and as they have been entirely accepting (no disappointment about grandchildren (though that's possible these days, of course)).

There's not much more to say here, really. I'm very thankful to be living in a country where we have full (legal, at least) equality, and amongst a community of people who are (I hope and fully expect) OK with it. If you are not, and you feel compelled to warn me that I will burn in hell: don't bother. I am a charter member of the UCT Atheist Students' Society; if hell were to exist, I would be well on the way there already!

Tags:

Radio frequency finder

Long ago, I used to have a website which listed the frequencies on which FM radio stations are broadcast from the various radio towers in the Cape Town area. That website died some years ago, but in the past I've had a couple of emails enquiring about it.

Anyway, I recently discovered FMSCAN, which allows you to select a location anywhere in the world and find out what radio stations you should be able to pick up there, and on what frequencies. So if you need that sort of information, now you know where to get it.

Ubuntu on an HP Compaq dx2300 Microtower

My new desktop at varsity is, as described in the title, an HP Compaq dx2300 Microtower. First thing I did when I got access to it was, of course, to install Linux - Ubuntu 8.10 in this case. It's a pretty nice machine (although not particularly high-spec) and pretty much everything worked straight away from install. The graphics card is Intel, so I'm not going to be doing any serious gameplaying (this is a work computer, anyway) but it runs Compiz pretty well. Being a desktop, suspend and hibernate aren't terribly important, but as it happens they work fine.

The only problem - and this is the main point of this post - was with the soundcard (an Intel HDA). The box has three audio outputs: headphone plugs front and back, and a tinny built-in speaker. Under Ubuntu all three outputs were switched on all the time, and it wasn't possible to adjust them separately. The purpose of headphones in a shared lab environment is entirely defeated if the built-in speaker is always on! I tried fiddling with all of the multitude of ALSA settings, but nothing worked. It couldn't have been a hardware problem, because it did the right thing under Windows.

So, the problem was narrowed down to the audio driver, snd-hda-intel to be specific. Some googling established that changing the model parameter to the module might have some effect on the output selection behaviour. Further searching established that the possible values are listed in Documentation/sound/alsa/HD-Audio-Models.txt in the kernel source. To find out what the possible values are, you have to know which codec your card uses. This you can do by running

cat /proc/asound/card0/codec#0 | grep Codec

For the dx2300 the result was Realtek ALC888. Indeed, under the list of models for the ALC888, there is one called "3stack-hp" for "HP machines with 3stack". Guessing that this was the correct one, I added to /etc/modprobe.d/alsa-base the line

options snd-hda-intel model=3stack-hp

and rebooted. Hey presto, suddenly the internal speaker switches off when headphones are plugged in.

tl;dr summary: If you have a dx2300 and you're having problems with the audio under Linux, then add the line options snd-hda-intel model=3stack-hp to the file/etc/modprobe.d/alsa-base (at least in Ubuntu; your distro might put module options in a different file).

Pages

Subscribe to