Newer
Older
naledi / visualize.R
#!/usr/bin/Rscript
### Visualize the topographical csv files output by terranostra.lisp
### Daniel Vedder, 12/9/2018

world = "world_large"
w = read.csv(paste0(world, ".csv"), header=F)

jpeg(paste0(world, "_topo.jpg"))
image(as.matrix(w), col=terrain.colors(range(w)[2]-range(w)[1]))
dev.off()

cols=c()
palette = terrain.colors(range(w)[2]-range(w)[1])
for (y in 1:length(w[1,])) {
    for (x in 2:length(w[,1])) {
        cols = c(cols, palette[w[x,y]+range(w)[1]])
    }
}

jpeg(paste0(world, "_iso.jpg"), width=720, height=720)
persp(1:100, 1:100, as.matrix(w), axes=F, theta=110, phi=50,
      expand=0.4, col=cols, box=F, shade=0.3)
dev.off()