drosofff
12/22/2016 - 3:34 PM

Reconstituted code for drawing hydrea. Some work still needed on dynamic cex and colours

Reconstituted code for drawing hydrea. Some work still needed on dynamic cex and colours

ramp <- colorRamp(c("darkred", "darkblue","green","black"))
x=seq(0,2*pi,by=0.001)
plot(sin(x)*cos(x)*exp(-sin(x)^3), sin(x)^2*cos(x)*exp(cos(x)^1/3),
     pch=20, cex=5/x, col=rgb( ramp(seq(0, 1, length = 20)), max = 255), xlab="", ylab="",xaxt="n", yaxt="n", asp=1 )
x=seq(0,10*pi,by=0.001)
plot(sin(x)*cos(x)*exp(-sin(x)^3), sin(x)^2*cos(x)*exp(cos(x)^1/3),
    pch=20, cex=5/x, col=sort(colors()[abs(rnorm(256,150,40))]) )
    
# with mixed pch
plot(sin(x)*cos(x)*exp(-sin(x)^3), sin(x)^2*cos(x)*exp(cos(x)^1/3),
    pch=rep(0:25, 1208), cex=7./x, col=sort(colors()[abs(rnorm(256,150,40))]))
    
# with colors from shape package
require("shape")
couleur = intpalette(c("black","dimgray","firebrick4"), numcol=100)
plot(sin(x)*cos(x)*exp(-sin(x)^3), sin(x)^2*cos(x)*exp(cos(x)^1/3), pch=20, cex=10/x, col=couleur)

# Annabelle's favorite
x=seq(0,10*pi,by=0.001)
plot(sin(x)*cos(x)*exp(-sin(x)^3), sin(x)^2*cos(x)*exp(cos(x)^1/3),
      pch=20, cex=4/x, col=rnorm(629,120,30) )
# or
x=seq(0,2*pi,by=0.001)
plot(sin(x)*cos(x)*exp(-sin(x)^3), sin(x)^2*cos(x)*exp(cos(x)^1/3),
    pch=20, cex=5/x, col=rnorm(629,120,30) )
    
# Series
x=seq(0,2*pi,by=0.001)
par(mar=c(0.2, 0.2, 0.2, 0.2), mfrow=c(3,3),
    oma = c(0.2, 0.2, 0.2, 0.2))
for (i in 1:9) {
plot(0,type='n',axes=FALSE,ann=FALSE, xlim=c(-1,1),ylim=(c(-.3,.5)))
points(sin(x)*cos(x)*exp(-sin(x)^3), sin(x)^2*cos(x)*exp(cos(x)^1/3),
    pch=20, cex=7/x, col=abs(rnorm(6284,120,30)) )
}

# Serie with 5 panels and pch variation
x=seq(0,2*pi,by=0.001)
> par(mar=c(0.2, 0.2, 0.2, 0.2), mfrow=c(1,5),
+     oma = c(0.2, 0.2, 0.2, 0.2))
for (i in 5:9) {
    plot(0,type='n',axes=FALSE,ann=FALSE, xlim=c(-1,1),ylim=(c(-.3,.5)))
    points(sin(x)*cos(x)*exp(-sin(x)^(3)), sin(x)^2*cos(x)*exp(cos(x)^1/3),
        pch=12+i, cex=10/(x*i^(1/2)), col=sort(abs(rnorm(100*i,190,40))) )
}