suburbia

Premshree's (品速力) Personal Weblog

etc.

Comparing eating out patterns in different cities: normalized graph
suburbia
[info]premshree

I normalized the data (see earlier post). Readable? Got suggestions on how to improve?

I ditched rgplot and instead used Gruff (wraps RMagick which wraps ImageMagick). Installation is pretty straightforward. However, I faced a problem with installing ghostscript on my OS X box. Something in the portfile is broken or something. Anyway, you might need to comment the following lines in the ghostscript portfile (typically something like /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/print/ghostscript/Portfile):

[...]

debc62758716a169df9f62e6ab2bc634 aj16.tar.Z md5
b24ac1b6966adf3a92edaae42eda662c ag14.tar.Z md5
f9cad1b32e56f65339da26266f568e97 ac15.tar.Z md5
a9d876f28dde1d4a0a6571eb0e281761 ak12.tar.Z md5

[...]

default_variants +aj16 +ag14 +ac15 +ak12


Another example of how CC-licensed stuff helps
suburbia
[info]premshree
Ebb and Flow: Mind-Body Health
A health-related video that makes use of lot of Creative Commons licensed stuff.

I got to know about the video because one of my photos is used.

Comparing eating out patterns in different cities
suburbia
[info]premshree

If there’s a city you’d like to see in the comparison, let me know.


People in Bangalore like to eat out on Sundays
suburbia
[info]premshree

Interestingly, folks in Bombay seem to like eating out on Tuesdays:

Notes:

1. Most people seem to end up using the tag “hotel” when they really mean to use “restaurant”, so I’ve gone with the former.
2. I rely on Flickr photo data and my program. You don’t have to take the graphs seriously.

Here’s the script I wrote to draw that graph (requires flickr.rb and rgplot):

#!/usr/local/bin/ruby18

require "../flickr"
require "gnuplot"

API_KEY = "078be2728a42f4e8228f2c2b8c9b6cca"

flickrObj = Flickr::Flickr.new(API_KEY, "")
photosObj = Flickr::Photos.new
days = Hash.new { |h,k| h[k] = 0 }
photosObj.search(["#{ARGV[0]}","hotel"], "all", 0, 1000).each { |ele|
	if /([0-9]+)\-([0-9]+)\-([0-9]+)/.match(photosObj.get_info(ele)["date_taken"])
		begin
			t = Time.mktime($1, $2, $3)
			days[t.strftime("%a")] += 1
		rescue
		end
	end
}
Gnuplot.open do |gp|
	Gnuplot::Plot.new(gp) do |plot|
		plot.title  "Photos taken in restaurants in #{ARGV[0]}"
		plot.ylabel "No. of Photos"
		plot.xlabel "Days"
		i = 0 
		plot.xtics("("+days.keys.map{|ele| "'#{ele}' #{i;i+=1}"}.join(",")+")")
		plot.data << Gnuplot::DataSet.new([(1..7).to_a, days.values]) do |ds|
			ds.with = "linespoints"
			ds.notitle
		end
	end
end

Usage: ./eating-out.rb city_name

Enjoy!