Category Archives: animation

My talk for Calculating and Communicating Uncertainty 2015 – and an experimental D3 page

Tomorrow and Wednesday I’ll be at the CCU2015 conference in Westminster. I’m talking in a workshop session on Wednesday on interactive graphics – and in particular, how they can be used to communicate uncertainty- so I thought I would make an¬†experimental page showing a couple of different ways of trying this. You can read my slides here and the experiment is here. While I’m sitting in the conference, I’ll probably tidy up a couple of rough edges, and in due course, I’ll make some more experiments. Please let me know what you think, and watch out for tweets with #ccu2015, although it means different things to different folks.

ccu-ex1

Leave a comment

Filed under animation, JavaScript, Visualization

Animated graphs hits the Stata blog

Chuck Huber of StataCorp (the voice behind those great YouTube videos) has just been blogging about animated graphs. He looks into using Camtasia software as well as my ffmpeg approach. And even if you’re not interested in making any such graph, go and look at some of his wonderful GIFs which would make great teaching tools, for example around power and sample size.

The more I use ffmpeg, the more I appreciate it. Working with video files is a real pain nowadays. There used to be more compatibility across software and operating systems and browsers, but not they all seem to be closing ranks. This is a good overview; although the terror of 2011 turned out to be a little overstated, the direction of travel is there and the HTML5 video tag remains flawed through lack of support from the software houses. Just today I’d been messing about moving video files from one computer to another in the vague hope that somewhere I would find the right combination of permissions that could open them, edit them and save them again. It was a struggle. The closest I got was the oldest OS I had on a laptop: XP (no, I’m not going to update it because the support ended yesterday! It was the last good one!). Then in the end I realised I could just do it all from the command line with ffmpeg. Plus you get to look like a badass hacker if anyone looks over your shoulder!

ffmpeg in action (compare and contrast with your favourite proprietary video software NOT in action). Borrowed from http://www.dedoimedo.com/computers/edit-multimedia-flash.html

Leave a comment

Filed under animation, Stata

Dataviz: good and bad

I’ve made a promise to myself not to blog anything until I get some more data processing tips written up on my website. But ‘ll break it just for a quick couple of links. One rocks, the other sucks.

First, an amazing visualization of current wind and weather conditions over the whole world, by Cameron Beccario. Source code here. This brings together a few different trendy tools: the data is automatically scraped, animated in a nice way with a planet that you can click and roll around. Very neat JavaScript, but also valuable as communication of quantitative information. Why is it better than just the old synoptic chart? Because it’s engaging, it gets people interested, and because you can see the whole story at a glance; you’re not limited to national boundaries. I think it’s potentially really useful for geography teachers everywhere. Arise, Sir Cameron. The next step would be to have it play the last week’s data as a video. I spotted it at Freakonometrics. The GIF below doesn’t really do it justice, by the way, go click on it.

tumblr_n0jg2s3aLv1toybivo1_500

Second, a graph spotted at Atlantic Cities which worried them because it looked like the whole world wants smaller households fast, and that’s going to cause environmental havoc. It worried me, on the other hand, because it just looked implausible. It’s amazing how complacent analysts* become as soon as they can switch on their stats software and do some fancy stuff. The common sense part of the brain powers down. Mmmm, breakpoints regression. Ooooh, bootstrapped starting values. Here’s a graph! What does it mean? Never mind that, let’s just publish the damn thing!

If you look at the slopes, the developed countries’ breakpoint is about 1893, which makes sense with industrialisation. The devloping countries have 1987, which doesn’t make so much sense. It’s not clear from the paper, but it looks like the breakpoint regression was done at country level, without weighting them by population. I’m happy to be corrected on that, but that’s what it looks like. That gives China and Swaziland exactly the same weight in pushing and pulling the line. And, most importantly, look over at the far right of the developing countries – there’s not many there with data since 1990 (they acknowledge this in the paper), and the ones who are there have smaller household sizes. Is it a trend or is it information bias? Smaller household <– healthier economy –> regular official statistics. This is not rocket science, it’s common sense. Think about what your data might mean! Aaargh.

households1

 

* – by “analysts”, I mean the authors of the paper, not Emily Badger whose writing and keen eye for interesting stats I have admired for some time

2 Comments

Filed under animation, JavaScript, Visualization

A couple of short stats animations

Conference season is over, and I have a lot of cool stuff to catch up on blogging. Here’s part 1.

Two animations of optimisation processes, one made with Yihui Xie’s R package and the other by an eerily Grantoid nuts-n-bolts approach where a lot of png files are saved and then turned into a stop frame animation using (apparently) ImageMagick (aka ffmpeg for wimps).

First, an OR kind of problem. 8 balls are scattered about in 2 dimensions. They then have to be moved to be equidistant. This is done with the R optim function and the old BFGS algorithm. I fondly recall my undergraduate studies where I had to program it in a calculator which I still have rusting in a drawer somewhere. I can’t believe looking back that I managed to do that. I must have learnt a lot, but one thing that didn’t stay with me was all those strange BFGS names. I think there was a Goldfarb and a Shanno, but the others are lost to me.

Image

Read the code here.

Next, one I think is more fun. A Metropolis algorithm with three chains seeks out the mean and variance parameters for some data. This is a 3-D-style wireframe plot, and the three chains appear like kittens moving around under a quilt, until they converge on the target distribution like a quivering mouse. Code here.

metrop

 

As testament to the fact that gifs are a really bad way of providing animations, one of them works on this blog, and one doesn’t. No idea why, nor is it worth any effort to find out! I think if you click you’ll see those crawling kittens of likelihood.

Leave a comment

Filed under animation

An animated 3-D (+ time) histogram

This video from Facebook Stories certainly caught my eye. There’s a lot going on here, probably too much really. It made me feel dizzy, which I guess would be the effect of listening to these songs if I were ever to actually encounter one.

Firstly, what’s with the time scale? Is it going up and down with time of day? And is the pulsing of color intensity just an effect to look kind of like a beat? What is the conclusion? Is there really a geographical difference? Hip hop in the hood and country in the, well, country? Maybe I am too old for it. But you have to hand it to them for clever programming.

Leave a comment

Filed under animation

animatedgraphs.co.uk is officially live!

Today I have updated the website at www.animatedgraphs.co.uk and it is now officially launched, including the new mascot Animated Ant.

It will continue to expand in coming weeks and months. My to-do list is:

  • Add a page on 3-D graphics, both things like wireframes that look 3-D and red/blue superimposed images that, when seen through the right glasses, really are 3-D
  • Add a page on maps (particularly Google maps)
  • Add advice on SPSS, which has no shell command to call ffmpeg from inside, but a batch file can run both the SPSS syntax and ffmpeg.
  • Get to grips with Excel VBA. There are a lot of people who would use Excel but not any stats software (they are mistaken of course, but let’s cross that bridge later…)

Suggestions and tasks for me to add to the list are very welcome!

Leave a comment

Filed under animation

Moneybombs: a really rich animation of US election donations

This is a very interesting piece of work by VisPolitics. They have maps, geolocated time series, and a density plot all in one, with names appearing on the right and moving vertically and in size over time. And all these aspects look good too. My favourite section is the Obama vs Romney one, which kicks off around 0:27. I liked it because it was clearer to me what was going on (as a Brit who has never set foot in Boston).

Of course, if it was interactive that would be even better, but a huge amount of work.

Leave a comment

Filed under animation