[R-es] Feliz Navidad (R code)

Sandra Barragán sandraba en eio.uva.es
Vie Dic 14 12:28:52 CET 2012


Muchas gracias Miguel Angel. Muy original, y muy friki jejeje.
Feliz Navidad para ti también!

El 14/12/2012 12:10, miguel.angel.rodriguez.muinos en sergas.es escribió:
> f.x = c(0.193,0.703,0.703,0.295,0.295,0.703,0.703,0.295,0.295,0.193,0.193)
> f.y = c(0.935,0.935,0.835,0.835,0.575,0.575,0.475,0.475,0.063,0.063,0.935)
> e.x = c(0.222, 0.787, 0.787, 0.324, 0.324, 0.757, 0.757, 0.324, 0.324,0.804, 0.804, 0.222)
> e.y = c(0.935, 0.935, 0.834, 0.834, 0.564, 0.564, 0.464, 0.464, 0.163,0.163, 0.063, 0.063)
> l.x = c(0.222,0.324,0.324,0.804,0.804,0.222)
> l.y = c(0.935,0.935,0.163,0.163,0.063,0.063)
> a1.x = c(0.433, 0.546, 0.865, 0.746, 0.656, 0.328, 0.242, 0.136)
> a1.y = c(0.935, 0.935, 0.063, 0.063, 0.326, 0.326, 0.063, 0.063)
> a2.x = c(0.488, 0.629, 0.355)
> a2.y = c(0.841, 0.418, 0.418)
> n.x = c(0.189, 0.295, 0.707, 0.707, 0.804, 0.804, 0.701, 0.287, 0.287, 0.189)
> n.y = c(0.935, 0.935, 0.248, 0.935, 0.935, 0.063, 0.063, 0.747, 0.063, 0.063)
> d.x = c(0.218,0.56,0.56,0.56,0.56,0.32,0.218,0.32,0.32)
> d.y = c(0.935,0.933,0.832,0.518,0.418,0.063,0.063,0.518,0.834)
> d.cir.th = seq(pi/2, -pi/2, length.out = 50)
> d1.cir.x = 0.32  + 0.515 * cos(d.cir.th)
> d1.cir.y = 0.499 + 0.436 * sin(d.cir.th)
> d2.cir.x = 0.32 + 0.4147 * cos(d.cir.th)
> d2.cir.y = 0.499 + 0.3 * sin(d.cir.th)
> d1.x = c(0.218, d1.cir.x, 0.32, 0.218)
> d1.y = c(0.935, d1.cir.y, 0.063, 0.063)
> d2.x = c(0.32, d2.cir.x, 0.32)
> d2.y = c(0.799, d2.cir.y,0.199)
> n.x = c(0.189, 0.295, 0.707, 0.707, 0.804, 0.804, 0.701, 0.287, 0.287, 0.189)
> n.y = c(0.935, 0.935, 0.248, 0.935, 0.935, 0.063, 0.063, 0.747, 0.063, 0.063)
> i.x = c(0.189, 0.295, 0.295, 0.189, 0.189)
> i.y = c(0.935, 0.935, 0.063, 0.063, 0.935)
> e.x = c(0.222, 0.787, 0.787, 0.324, 0.324, 0.757, 0.757, 0.324, 0.324,0.804, 0.804, 0.222)
> e.y = c(0.935, 0.935, 0.834, 0.834, 0.564, 0.564, 0.464, 0.464, 0.163,0.163, 0.063, 0.063)
> z.x = c(0.222,0.787,0.787,0.322,0.804,0.804,0.222,0.222,0.687,0.222)
> z.y = c(0.935,0.935,0.834,0.163,0.163,0.063,0.063,0.163,0.834,0.834)
> v.x = c(0.136, 0.259, 0.496, 0.734, 0.853, 0.543, 0.441)
> v.y = c(0.935, 0.935, 0.163, 0.935, 0.935, 0.063, 0.063)
> draw.ch = function(x1, y1, x2 = NULL, y2 = NULL, center.x,
>      color, alpha, xscale) {
>      rgb.col = col2rgb(color)/255
>      x1 = x1 * xscale + center.x - 0.5 * xscale
>      x2 = x2 * xscale + center.x - 0.5 * xscale
>      polygon(x1, y1, col = rgb(rgb.col[1], rgb.col[2], rgb.col[3],
>          alpha = alpha), border = NA)
> #    polygon(x2, y2, col = "black", border = NA)
>       polygon(x2, y2, col = "white", border = NA)
> }
> x1 = list(f.x, e.x, l.x, i.x, z.x, n.x, a1.x,v.x,i.x,d1.x,a1.x,d1.x)
> y1 = list(f.y,e.y,l.y,i.y,z.y,n.y,a1.y,v.y,i.y,d1.y,a1.y,d1.y)
> x2 = list(NULL,NULL,NULL,NULL,NULL,NULL,a2.x,NULL,NULL,d2.x,a2.x,d2.x)
> y2 = list(NULL,NULL,NULL,NULL,NULL,NULL,a2.y,NULL,NULL,d2.y,a2.y,d2.y)
> th = seq(pi/6, 2 * pi, length.out = 12)
> cols = rainbow(200)
> for (j in 1:999) {
>          th = th - pi/120
>          center.x = 3 + 5 * cos(th)
>          cols = c(cols[-1], cols[1])
>          alpha = 0.1 + (50 * (1 - sin(th)))/100
>          alpha = ifelse(alpha > 1, 1, alpha)
>          xscale = -sin(th) * 1.2
>          plot(1, xlim = c(-2, 8), ylim = c(-2.5, 3.5), type = "n")
>          plot.order = (1:12)[order(xscale > 0)]
>          for (k in 1:12) {
>              i = plot.order[k]
>              draw.ch(x1[[i]], y1[[i]], x2[[i]], y2[[i]], center.x[i],
>                  color = cols[k + 60 * ( i >= 6 & i <= 8 ) + 120 *
>                      (i > 8)], alpha[i], xscale[i])
>          }
> }
>
>
> ## Un Saludo,
> ## ________________________________________________________
> ## Miguel Ángel Rodríguez Muíños
> ## @mianromu
> ## Dirección Xeral de Innovación e Xestión da Saúde Pública
> ## Consellería de Sanidade
> ## Xunta de Galicia
> ##
> ## http://dxsp.sergas.es
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Nota: A información contida nesta mensaxe e os seus posibles documentos adxuntos é privada e confidencial e está dirixida únicamente ó seu destinatario/a. Se vostede non é o/a destinatario/a orixinal desta mensaxe, por favor elimínea. A distribución ou copia desta mensaxe non está autorizada.
>
> Nota: La información contenida en este mensaje y sus posibles documentos adjuntos es privada y confidencial y está dirigida únicamente a su destinatario/a. Si usted no es el/la destinatario/a original de este mensaje, por favor elimínelo. La distribución o copia de este mensaje no está autorizada.
>
> See more languages: http://www.sergas.es/aviso_confidencialidad.htm
>
> _______________________________________________
> R-help-es mailing list
> R-help-es en r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-help-es
>
>
>



Más información sobre la lista de distribución R-help-es