Showing posts with label just because. Show all posts
Showing posts with label just because. Show all posts

Sunday, December 18, 2011

holiday caRd

I wasn't planning on making any more "caRds", but since I received a number of requests, find below a holiday card from the EEB & flow. For optimal viewing, perhaps throw some Jingle Bells on in the background.

This code relies heavily on the rgl package in R. Be sure to run the first line of code to install this package if you don't already have it. 

###holiday caRd

#install "rgl" package if necessary:
install.packages("rgl")

#load library
library(rgl)

##Data
r=1.0
h=5.0
m=h/r
x=seq(0:99)
y=x
X=x*cos(y)
Y=x*sin(y)
Z=-1*(m*x)
Z1=Z+rnorm(length(Z),Z,5)
sub<-matrix(subset(c(X,Y,Z),Z==max(Z)),ncol=3)
trunk<-matrix(c(0.54,0.84,-200,0.54,0.84,-650),byrow=TRUE,ncol=3)
sno<-c(0,rep(15,9))

##Plot card
open3d(FOV=1)
par3d(windowRect=c(100,100,600,600))
bg3d("aquamarine2")
plot3d(X,Y,Z,col="darkgreen",type="l",box=FALSE,axes=FALSE,lwd=10,zlim=c(min(Z),0),xlab="",ylab="",zlab="",top=TRUE,border=TRUE)
plot3d(X,Y,Z,col=c("yellow","red"),add=TRUE,type="s",radius=3)
points3d(sub,col="orange",size=10)
lines3d(trunk,col="brown",lwd=20)
text3d(matrix(c(0.54,-100,300),ncol=3),text="Happy Holidays",font=5,cex=1.9,color="darkred",adj=c(0.5,1))
text3d(matrix(c(0.54,0.84,-650),ncol=3),text="and",font=5,cex=1.5,color="darkred",adj=c(0.5,1))
text3d(matrix(c(0.54,75,-780),ncol=3),text="a Happy New Year",font=5,cex=1.9,color="darkred",adj=c(0.5,1))
mat<-par3d("scale")

##Play card
for(i in 1:10){
par3d(scale=mat,ignoreExtent=TRUE)
points3d(matrix(c(sample(-160:160,sno[i]),sample(-160:160,sno[i]),sample(-500:150,sno[i])),ncol=3),col="white",size=3)
play3d(spin3d(axis=c(0,0,1)),duration=1)
if(i==10){points3d(sub,col="darkorange",size=17)
plot3d(X,Y,Z,col=c("yellow","red"),type="s",radius=4,add=TRUE) } }
text3d(matrix(c(0,140,-900),ncol=3),text="From the EEB & Flow",font=1,cex=1.0,color="darkgreen",adj=c(0.5,1))


##The rgl device window allows you to use your mouse to manipulate the plot in 3-dimensions, so feel free to do so before closing it.

You can also access the script here.

Thursday, October 27, 2011

halloween caRd

To view the card, run the code below using R

###########################################################################

###required libraries
##if you do not have the "fields" and "MBA" libraries, you need this step to install them
install.packages("fields")
install.packages("MBA")
## load libraries
library(fields)
library(MBA)

###data
data<-matrix(c(44.9186,81.0824,46.9512,80.1061,49.187,80.7055,57.9268,80.1493,60.3659,81.34,69.3089,80.1941,78.4553,79.2459,91.8699,70.834,99.7967,55.9047,101.2195,30.9102,96.1381,17.3075,85.5691,7.4235,74.3902,4.2299,61.7886,1.8181,55.4878,1.0059,49.187,0.9811,45.3252,1.7532,37.1951,1.9181,20.3252,7.1666,8.9431,17.1612,4.2683,29.1507,4.2683,50.8042,9.5528,66.3761,18.4959,76.2539,29.065,80.6261,38.6179,80.8607,44.9186,81.0824),ncol=2,byrow=TRUE)
stem<-matrix(c(60.3659,81.34,57.9268,80.1493,49.187,80.7055,46.9512,80.1061,44.9186,81.0824,45.5285,83.6438,47.561,88.1794,44.1057,97.2209,48.7805,99.9952,54.878,87.6176,60.3659,81.34),ncol=2,byrow=TRUE)
eye<-matrix(c(45.935,46.4407,34.1463,44.8195,36.7886,46.9952,36.382,50.9306,32.3171,53.08,29.065,53.0672,26.0163,49.7086,28.0488,45.1892,20.3252,48.7021,20.1219,55.3942,23.5772,61.1164,30.8942,65.476,32.3171,59.7729,45.935,46.4407),ncol=2,byrow=TRUE)
eye2<-matrix(c(58.9431,46.6888,65.4472,51.2419,71.748,56.9754,74.3902,65.4504,82.7236,59.7745,84.9593,56.4368,84.7561,48.562,77.439,45.7772,78.8618,50.5072,74.3902,53.6393,69.9186,51.6532,68.6992,47.9083,70.5285,44.9627,58.9431,46.6888),ncol=2,byrow=TRUE)
mouth<-matrix(c(8.9431,44.7202,23.374,41.2338,30.0813,22.7562,38.2114,38.5363,65.0407,38.445,73.374,22.533,80.2846,40.8673,96.9512,44.673,93.4959,31.8641,84.1463,18.8352,66.2602,9.7097,61.9919,16.1889,59.3496,8.3045,45.5285,8.447,42.8862,16.1137,38.2114,9.4024,22.7642,17.4125,11.9919,31.7401,8.9431,44.7202),ncol=2,byrow=TRUE)
stars<-matrix(c(sample(seq(0,100),80),sample(seq(20,100),80,replace=TRUE)),ncol=2)

###plot
par(bg = "black")
par(mar=c(5,2,4,2))+0.1
plot(data,type="n",xlim=c(0,100),ylim=c(0,100),xaxt="n",yaxt="n",xlab="",ylab="",axes=FALSE)
symbols(x=stars[,1],y=stars[,2],circles=rep(0.001,nrow(stars)),inches=0.015,bg="white",xlim=c(0,100),ylim=c(0,100))
col<-runif(nrow(data),min=4,max=7)
datmb<-mba.surf(matrix(cbind(data,col),ncol=3),no.X=200,no.Y=200,extend=FALSE)
image(datmb$xyz,zlim=c(0,10),col=heat.colors(40),add=TRUE)
polygon(stem,col="darkgreen")
polygon(eye,col="yellow")
polygon(eye2,col="yellow")
polygon(mouth,col="yellow")
points(data,type="l")
mtext("Happy Halloween",side=3,col="green3",cex=3.5,font=4)
mtext("from the EEB and Flow",side=1,col="green3",cex=2.5,font=4)

Wednesday, June 29, 2011

The reality of publishing papers

This is in response to my undergrads, who ask me "Have you published any of the stuff we're working on yet?" practically every week. To which my response invariably is "not yet".


(click to make larger)

Friday, April 15, 2011

The bellybutton, biodiversity reserve of the body



Although less recognized--and less glamourous--than most biodiversity hotspots, the human bellybutton harbours it own diverse collection of species, and these species tell us something about ourselves. That's the premise behind the Belly Button Biodiversity Project, which is getting some press for its large-scale sampling of bellybutton bacteria. For interesting discussion about where the data could lead, see Rob Dunn's (one of the researchers) website. His post, including the comments, hints at how much there is to learn about the ecology of human bacteria.

Update: Rob Dunn has now published a book "The Wild Life of Our Bodies", telling more stories of our changing relationships with other species.