Skip to content

Visually analyze distribution of data using a scatterplot

Corion edited this page Jun 11, 2011 · 1 revision

While developing Random::PoissonDisc, I want to know if the module produces the "right" random data. Instead of firing up a statistical analysis, I know that the distribution should generate points evenly spaced across the plane, with a minimum distance of 10 units between each point. So I generate test data as (x,y) pairs output to STDOUT and pipe these into ffeedflotr.pl:

24.4129655649886	24.416205030866
28.538216147295	36.9806667873347
36.3469658463998	31.3267757436954
...

perl -w bin\ffeedflotr.pl t\random-poissondisc-fail1.txt --type=scatter --xmax=100 --ymax=100

The output looks like this:

Wrong distribution scatter plot

This is obviously wrong, because there is more than one point in each 10x10 grid. So I need to debug more. After another debug session, I've found and corrected my errors. I can easily inspect that the result matches my expectation:

94.3569694878533	64.9396553169936
86.5389122306123	82.4642248906386
79.6713278036337	60.4840092804682
...


perl -w bin\ffeedflotr.pl t\random-poissondisc-better1.txt --type=scatter --xmax=100 --ymax=100

Correct distribution scatter plot