Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Friday, January 02, 2026

We Didn't Start the Fire Graph


I made a graph of when people in "We didn't start the fire" were born, did the act referenced in the song and died. Because Bridget Bardot died people found it interesting that only three people. Chubby checker, Bob Dylan and Bernie Goetz remain alive of those mentioned in the song.


The reddit post of the graph got popular and it was picked up by a few online newspapers.



People Magazine, The Poke, the Expressfox news and extra.ie  and the Irish star


Bonus points for a tabloid including my argument about Popperian epistemology in their quotes.

There were a few weird things I found out in this process. 
None of the journalists messaged me. My handle was in the image and you can message the creator of a post on reddit but none did. The poke messaged me when I was one of their 25 funny tweets of the week 4 years ago, so not doing that now about an entire article is a change.

I found a few of the authors of articles email addresses. This is hard now as how to contact a journalist now seems to be hidden. I messaged them a new version of the graph with some fixes in case they want to use that one instead, but none replied.

A fair few of the Articles using my picture I can't see as they are geo-blocked. It is a bit odd that they can take something I made and not talk to me and not let me see they thing they made from it.


and

and




My silly picture is not important. But on a bigger scale huge numbers of silly pictures and jokes have made the internet fun for the last several decades. And in my experience when one of these was yours in the past some amount of credit came back to you. It didn't pay any bills or anything. But it did feel in some way that you putting in an effort was recognised and at least part of a very large group of people making silly stuff to entertain people. If the incentives are now one way, where a news organisation can use something and you can't even see it that seems like the general internet bargain has become skewed. 



Tuesday, March 25, 2025

Doctor Deaths in the Famine

During the famine doctors cared that many of their number were dying. the collected data and wrote up their findings in the The Dublin quarterly journal of medical science Volume 5, 1848. in the section Art. VII. — On the Mortality of Medical Practitioners in Ireland. Second Article. By James William Cusack, M. D. President of the Royal College of Surgeons, and William Stokes, M. D., Regius Professor of Physic in the University of Dublin.


These data tables seem never to have been graphed before. But now using OCR it is really easy to extract the data.
Here for the first time ever is graphs of what doctors recorded as killing them







A python notebook to make these is here and data here.

Wednesday, September 27, 2017

Pi Digits High Low Game

Suppose you take a long number and for each digit if it is bigger then the previous one increase a counter by one. If it is less then the previous number reduce the counter by one. You keep a running total and graph that total. Noting when it passes 0. This total number will go up and down and can get to zero many times. If you play this game with random numbers in a million digits on average the number of times you will have crossed 0 is 1594.4 and the standard deviation of the number of times crossed 0 is 1207.3. Though as the number of times zero is crossed cannot be less then 0 this is a bit odd.
       
import random

numcrossed=[]
j=0
while j < 200:
	i = 0
	last=0
	total=0
	x=[]
	y=[]
	crossed=0
	while i < 1000000:
		ran= random.randint(0, 10)
		if ran==last:
			total=total
		elif ran>last:
			total=total+1
		else:
			total=total-1
		if total==0:
			x.append(i)
			y.append(total)
			crossed=crossed+1        
		i=i+1        
		last=ran
	numcrossed.append(crossed)
	j=j+1
       
 
If instead of random numbers the digits of pi are used. This is what the path of total counts looks like
       
file = open("pi1000000.txt", "r") 
#3.14159265358979323846264338327950 pi2.txt
x = []
y = []
text=file.read() 

pi = list(text)
total =0
i = 0
crossed=0
i=0

while i < len(pi):
	if pi[i]>pi[i-1]:
		#print(pi[i])
		total=total+1
	if pi[i]
 

Pi has a 0 total 657 times. Which is more than 51 out of 200 random million long sequences did in my tests. None of this means anything. Going up or down based on digits in a base ten number but i like these pattern sort of sequences.

E crosses 0 1725 times

sqrt2 crosses 0 1300 times

and with 2 million digits


The python code for visualisation is 
       
import numpy as np
import matplotlib.pyplot as plt

plt.scatter(x, y, alpha=0.5, color='green')
plt.title('Sqrt 2 High Low Game')
plt.show()
       
 

Thursday, November 14, 2013

Wheat Map of the US

I thought it would be cool to make a map of the US counties by how much wheat they grew. I took the code from this article and from the Visualize Data book by Nathan Yau

I got some wheat data from here the US department of Agriculture. The map of the US comes from here

Then I cleaned up the data by taking only the columns for state, county and total wheat production. This dataset includes a county 888 and 999 but that seems to be a combination of all the states counties so I stripped those out. Also there are more than 50 states in these county datasets which seems to be standard. There is always messing with numbers being seen as strings with these sorts of manipulations so some casting is needed.

The svg is 1.9 mbs and google drive does not want to store or convert it at the moment but if anyone wants it I can send it to them. This quality of file means zooming in on an individual state, like Kansas, is fine.

The code to create this picture is here.

JDLong on twitter pointed out where to get data for countries. I got the grains from here and a look at the 'head psd_grains_pulses.csv' shows the file layout

I think I want Country_code and value for the commodity wheat in every country in the most recent year value. The country code is 2 characters (iso 3166-1 alpha 2) and the map I have from wikipedia is that format you can get it here

The code to produce colors for each country based on this data is here. Again this is based on the "Visualize This" book from Yau. This css code to set the color of each country gets pasted into the style section of the BlankMap-World6.svg file. I should read all the documentation describing the values before doing any analysis like this. But I am only doing this to make pretty pictures in Python so I am making assumptions to work quickly.

extra: I made a stacked area graph of what crops have been grown when here with the code here.