#mvelection2013

2013 Maldives presidential election results analytics

function r(id, label, mdp, ppm, jp, gi, invalid, nonvoters, max) {
  var total = mdp+ppm+jp+gi+invalid+nonvoters+max;
  var canvas = document.createElement('canvas');
  var chartwidth = 2100;
  var chartheight = 50;
  var top = 2;
  if (max < 10000 && max != 0) {
    canvas.width = 2100; 
  } else {
    chartwidth = 800;
    canvas.width = chartwidth ;   
  }
Islands of Maldives

Islands of Maldives (aligning together)

import processing.video.*;
MovieMaker mm;
....
float x = -7000 + float(pieces[6])*100;
float y = 715 + float(pieces[7])*-100;
scale(50);
String[] shapes = split(pieces[0], ',');

beginShape();
  for (int nodes = 0; nodes < shapes.length; nodes = nodes+1) {
    String[] xy = split(shapes[nodes]," ");  
    float x1 = -7000 + float(xy[0])*100 - x+6.4;
    float y1 = 715 + float(xy[1])*-100 - y+4.0;
    vertex(x1, y1);
  }
endShape(CLOSE);
UNDP Rakaavethibeyyaa Dhivehiraaje

Generative logo design

foreach ($xml->children() as $atolls) {
  $island_count = 0;
  foreach ($atolls->children() as $atoll){
    $content .= '';
    foreach ($atoll->children() as $island){
      $content .= 'x  . '" y="' . $island->y . '" 
              width="' . $island->size . '" height="'. $height .'" 
              fill="black"  />  ';  
    }
    $content .= '';
  }
}
Framing Leaders

Algorithmically generated framed pictures of heads of governments

#!/usr/bin/python
#
import datetime
for row in cursor.fetchall():
  if row['country_code'] + ".png" in srcfiles:
    x = datetime.datetime.now().date() - row['h_gov_since']
    if x.days > 365*2:
      years = " ("+ str(math.floor(x.days/365))[:-2] + " years)"
    elif x.days < 365:
      years = " ("+ str(x.days) + " days)"
      
    else:
      years = " ("+ str(math.floor(x.days/365))[:-2] + " year)" 
    img = row['country_code'] + ".png"
    imgs.append(img)
    li[img] = row['country_name'].capitalize() + years
    height.append(Image.open(pathx + img).size[1]+35)
    width.append(Image.open(pathx + img).size[0]+20)
mvblogosphere

Mapping of the Maldivian blogosphere (2006-2014)

                       __      __                                            __  
   ____ ___  _   __   / /_    / /  ____    ____ _  ____    _____    ____    / /_ 
  / __ `__ \| | / /  / __ \  / /  / __ \  / __ `/ / __ \  / ___/   / __ \  / __ \
 / / / / / /| |/ /  / /_/ / / /  / /_/ / / /_/ / / /_/ / (__  )   / /_/ / / / / /
/_/ /_/ /_/ |___/  /_.___/ /_/   \____/  \__, /  \____/ /____/   / .___/ /_/ /_/ 
                                        /____/                  /_/              
                    
  ___    _____  ___ 
 / _ \  / ___/ / _ \
/  __/ / /    /  __/
\___/ /_/     \___/