Scatter plot for still lifes (R help needed)
Posted: July 27th, 2016, 7:43 pm
I was thinking it would be nice to have a scatter plot of (total) still life counts vs. populations in the Catagolue article on the LifeWiki (which is why I'm sticking this in "Website Discussion", BTW), akin to the upper plot on page 2 of the full results for Andrzej Okrasinski's census.
That sort of thing's best done programmatically, so I turned to R, which I vaguely recalled being told was useful; but I've never used that before myself, and found it rather unwieldy, so I was wondering if anyone here either a) was an R wizard who could help improve the following plot, or b) had suggestions for a better tool.
For now here's the current best attempt at a plot I have:
Here's the R script used:
And finally, the data file (note that this was generated from somewhat older data; I'd use newer data when generating an image to upload to the LifeWiki):
So, yeah. Any tips on how to improve this plot? R seems to offer precious little control over formatting, axes, labels, ticks etc., but maybe I'm just looking in the wrong places.
Alternatively, any other (better) tools to generate such plots? Programs that can be used non-interactively (i.e. called with a script as part of a shell script) would be very strongly preferred.
That sort of thing's best done programmatically, so I turned to R, which I vaguely recalled being told was useful; but I've never used that before myself, and found it rather unwieldy, so I was wondering if anyone here either a) was an R wizard who could help improve the following plot, or b) had suggestions for a better tool.
For now here's the current best attempt at a plot I have:
Here's the R script used:
Code: Select all
library(bit64)
options(scipen=100)
stilllifes <- read.table("xs_scatterplot.dat", header=TRUE);
attach(stilllifes)
## svg("xs_scatterplot.svg", width=10, height=10, antialias="subpixel")
png("xs_scatterplot.png", width=640, height=640, antialias="cleartype")
plot(Population, Count, log="y", lab=c(length(Population), ceiling(log10(max(Count)))+1, 7), xaxs="i")
## text(Population, Count, Count, cex=0.6, pos=4, col="red")
legend("topright", inset=0.05, title="Total still lifes", c("Count", "Linear fit", expression(paste("LOWESS fit, ", alpha, "=0.3"))), pch=c(21, -1, -1), lty=c(0, 1, 1), col=c("black", "black", "blue"))
title(main="Total still lifes by population")
abline(lm(log10(Count)~Population))
lines(lowess(stilllifes, f=0.3), col="blue")
dev.off()
Code: Select all
Population Count
4 37230663244700
5 5217667971195
6 22811439059639
7 6028058512999
8 1151083489759
9 6130605168
10 4179800708
11 1236556937
12 186490260778
13 157670526
14 71439981537
15 423074176
16 2672307142
17 140665171
18 502771638
19 17640474
20 62870208
21 1460833
22 9283930
23 454126
24 409529
25 209479
26 142231
27 30761
28 2932260
29 8988
30 43911
31 17135
32 7052
33 177
34 300
35 23
36 51
37 9
38 402
39 4
40 5092
41 2
42 64
45 1
46 1
Alternatively, any other (better) tools to generate such plots? Programs that can be used non-interactively (i.e. called with a script as part of a shell script) would be very strongly preferred.