[R-br] Cartão de Natal No R [off-topic]

Augusto Ribas ribas.aca em gmail.com
Segunda Dezembro 19 21:37:36 BRST 2011


Ha, segue um cartão de natal feito com o R.
Eu vi no Blog da revista Oikos:
http://oikosjournal.wordpress.com/2011/12/19/merry-christmas/

Mas o código esta neste blog aqui:
http://evol-eco.blogspot.com/2011/12/holiday-card.html

Feliz natal a todos :)

###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.



-- 
Grato
Augusto C. A. Ribas

Site Pessoal: http://augustoribas.heliohost.org
Lattes: http://lattes.cnpq.br/7355685961127056
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20111219/944e14a5/attachment.html>


Mais detalhes sobre a lista de discussão R-br