[R-br] Ajuda para criar um grafico

Humberto hghazin em hotmail.com
Quinta Outubro 25 16:57:52 BRST 2012


Leonard,

Muito obrigado pela ajuda mais uma vez!

Abr

Humberto


Em 10/25/2012 2:57 PM, Leonard de Assis escreveu:
> quanto ao fundo cinza:
>
> my_theme <-
>   theme(
>     legend.position = "bottom",
>     plot.title = element_text(size = rel(1.5)),
>     panel.background =
>       element_rect(fill = "white"),
>     panel.border =
>       element_rect(colour = "black", fill="transparent", 
> linetype="solid"),
>     panel.grid.major =
>       element_line(colour = "darkgrey", linetype = "dashed"),
>     panel.grid.minor =
>       element_line(colour = "dark grey", linetype = "dotted")
>   )
>
> forestplot(d) + my_theme
>
> este my_theme é um tema que eu utilizo em meus gráficos. Basta alterar 
> nos locais certos
>
> quanto ao posicionamento da linha vertical, substitua 'aes(x=0)' por 
> 'aes(x=1)'
>
>
> []s
> Leonard de Assis
> assis <dot> leonard <at> gmail <dot> com
> Em 25/10/2012 13:18, Humberto escreveu:
>> Olá Andre, Ivan e Leonard
>>
>> Muito obrigado pela ajuda! eu consegui dessa forma aqui! Porém no 
>> eixo dos x esta aperecendo numeros que se sobrepostos aos nomes das 
>> espécies que não estou conseguindo retirar. Alguem poderia me ajudar 
>> nesse sentido!
>>
>> Gostei dessa alternativa do forestplot. Como faço para retirar esse 
>> background (cinza) do forestplot e adicionar a linha vertical no 1?
>>
>> E mais uma vez obrigado a todos pela ajuda
>>
>> tableMat1a é a tabela abaixo
>>
>>                     Specie    lci     or   uci
>> 1             Bigeye tuna 0.0952 0.1293 0.176
>> 2          Yellowfin tuna 0.0916 0.1255 0.172
>> 3                Albacore 0.0913 0.1562 0.267
>> 4               Swordfish 0.1311 0.1565 0.187
>> 5                Sailfish 0.0368 0.0923 0.231
>> 6            White marlim 0.1300 0.2161 0.359
>> 7             Blue marlim 0.0738 0.1471 0.293
>> 8              Blue shark 0.1303 0.1653 0.210
>> 9         Crocodile shark 0.1123 0.1792 0.286
>> 10       Pelagic stingray 0.1074 0.2052 0.392
>> 11           Turtle oliva 0.1275 0.3802 1.134
>> 12 Oceanic whitetip shark 0.1658 0.3788 0.866
>>
>>
>> par(mar=c(2, 8, 0, 0))
>> y.axis <- c(length(tableMat1a$or):1)
>> plot(tableMat1a$or,y.axis, type = "p", axes = F, xlab = "", ylab = 
>> "", pch = 19, cex = 1.2,
>>      xlim = c(0,1.2), xaxs = "r", main = "")
>> segments(tableMat1a$lci, y.axis, tableMat1a$uci, y.axis, lwd =  1.5)
>> axis(1, at = seq(0,1.2,by=0.2), labels = NA, tick = T,
>>      cex.axis = 1.2, mgp = c(2,.7,0))
>> axis(2, at = y.axis, label = tableMat1a$Specie, las = 1, tick = F, 
>> ,mgp = c(2,.6,0),cex.axis = 1.2)
>> segments(1,1,1,30,lty=1)
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Em 10/25/2012 12:09 AM, Leonard de Assis escreveu:
>>> Andre,
>>>
>>> vi a pouco na lista do ggplot2 um script que pode ser o que voce 
>>> procura.
>>>
>>> # d is a data frame with 4 columns
>>> # d$x gives variable names
>>> # d$y gives center point
>>> # d$ylo gives lower limits
>>> # d$yhi gives upper limits
>>> forestplot <- function(d, xlab="Odds Ratio", ylab="Study"){
>>>   require(ggplot2)
>>>   p <- ggplot(d, aes(x=x, y=y, ymin=ylo, ymax=yhi)) +
>>>     geom_pointrange() +
>>>     coord_flip() +
>>>     geom_hline(aes(x=0), lty=2) +
>>>     ylab(xlab) +
>>>     xlab(ylab) #switch because of the coord_flip() above
>>>   return(p)
>>> }
>>>
>>> # Create some dummy data.
>>> d <- data.frame(x = toupper(letters[1:10]),
>>>                 y = rnorm(10, .05, 0.1))
>>> d <- transform(d, ylo = y-1/10, yhi=y+1/10)
>>>
>>> forestplot(d)
>>>
>>> []s
>>> Leonard de Assis
>>> assis <dot> leonard <at> gmail <dot> com
>>> Em 24/10/2012 23:55, andrebvs escreveu:
>>>> Olá Humberto!
>>>> Eu até começei a fazer o que estava querendo, porém, não consegui 
>>>> implementar os intervalos de confianças com as respectivas médias. 
>>>> Segue um script abaixo até onde cheguei, se alguém puder continuar 
>>>> e sanar sua dúvida, seria uma grande ajuda!
>>>>
>>>> library(fields)
>>>> plot(xlim=c(0,1.8),5:10, bty='n',type="n",axes=F,xlab="Relative 
>>>> catchability",ylab="")
>>>> x <- seq(0.0,1.8,by=0.2)
>>>> y <- seq(5,14)
>>>> u <- 1
>>>> v <- 50
>>>>
>>>> axis(1,lwd=2,at = x,labels = formatC(x, format="fg"))
>>>> abline(v = 1, col = "black",lty=1,lwd=2)
>>>> arrow.plot(x[6],y[6],v,u,arrow.ex=.4, length=.2, col='black', lwd=2)
>>>> arrow.plot(x[6],y[6],u-360,v-45,arrow.ex=.5, length=.2, 
>>>> col='black', lwd=2)
>>>>
>>>> text(0,7,"Bigeye\nYellowfin 
>>>> tuna\nAlbacore\nSwordfish\nSailfish\nWhite marlim\nBlue 
>>>> marlim\nBlue shark\nCrocodile shark\nPelagic stingray\nTurtle 
>>>> oliva\nOceanic whitetip shark",cex = 0.8,adj=c(0,0))
>>>>
>>>> text(1.1,5,"Species\nBigeye tuna\nYellowfin 
>>>> tuna\nAlbacore\nSwordfish\nSailfish\nWhite marlim\nBlue 
>>>> marlim\nBlue shark\nCrocodile shark\nPelagic stingray\nTurtle 
>>>> oliva\nOceanic whitetip shark",cex = 0.8,adj=c(0,0))
>>>>
>>>>
>>>> /Att./
>>>> /André Barbosa Ventura da Silva/
>>>> ------------------------------------------------------------------------
>>>> Em 24/10/2012 20:38, *Ivan Bezerra Allaman < 
>>>> ivanalaman em yahoo.com.br >* escreveu:
>>>> Utilize as funções plot, segments e par para obter êxito! O link 
>>>> abaixo será útil também.
>>>> http://gallery.r-enthusiasts.com/
>>>> (S,f,P)
>>>> Allaman
>>>> **
>>>> \begin{signature}
>>>> <<>>=
>>>> Prof. Dr. Ivan Bezerra Allaman
>>>> Universidade Estadual de Santa Cruz
>>>> Departamento de Ciências Exatas e Tecnológicas
>>>> Ilhéus/BA - Brasil
>>>> Fone: +55 73 3680-5596
>>>> E-mail: ivanalaman em yahoo.com.br/ivanalaman em gmail.com
>>>> @
>>>> \end{signature}
>>>>
>>>>
>>>> _______________________________________________
>>>> R-br mailing list
>>>> R-br em listas.c3sl.ufpr.br
>>>> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
>>>> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.
>>>
>>>
>>>
>>> _______________________________________________
>>> R-br mailing list
>>> R-br em listas.c3sl.ufpr.br
>>> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
>>> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.
>>
>>
>>
>> _______________________________________________
>> R-br mailing list
>> R-br em listas.c3sl.ufpr.br
>> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
>> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.
>
>
>
> _______________________________________________
> R-br mailing list
> R-br em listas.c3sl.ufpr.br
> https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
> Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.

-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20121025/0c46e173/attachment.html>


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