Luckily, I didn't need to rebuild my R version with cairo support - i just installed the R package Cairo and then used its function CairoSVG()
the code for the figure...
require(Cairo) set.seed=1111 orbits=10 n.per.orbit=100 angle=rep(seq(0,2*pi, by=2*pi/(n.per.orbit-1)),orbits) wander<-runif(orbits*n.per.orbit, -1,1) pos<-scale(cumsum(wander))+5 fit <- smooth.spline(pos) spl.pred <- predict(fit)$y x<-sin(angle)*spl.pred y<-cos(angle)*spl.pred COL <- rainbow(length(y)) CairoSVG(file = "circle_art.svg", width = 6, height = 6, bg = "black") par(mar=c(0,0,0,0), bg="black") plot(x, y, t="n") segments(x[1:(length(x)-1)], y[1:(length(y)-1)], x1=x[2:length(x)], y1=y[2:length(y)], col=COL, lwd=3, lend=0) dev.off()
No comments:
Post a Comment