[R-br] GGPLOT

Fernando Gama f.fabiogama88 em gmail.com
Segunda Fevereiro 23 17:55:49 BRT 2015


Olá Edson boa tarde,

meu caro, não sei se esssa é a melhor solução mas você poderia utilizar
text(). Utilizei nos meus scripts e atendeu minhas expectativas:

a library da função pode ser encontrada neste link:
http://stat.ethz.ch/R-manual/R-devel/library/graphics/html/text.html

abraços

2015-02-23 17:48 GMT-03:00 Edson Lira <edinhoestat em yahoo.com.br>:

> Meus caros amigos, estou tentando usar um exemplo de aplicação de MCA,
> script abaixo:
>
> #Usando MCA
> # load packages
> require(FactoMineR)
> require(ggplot2)
>
> # load data tea
> data(tea)
> tea
> names(tea)
> # select these columns
> newtea = tea[, c("Tea", "How", "how", "sugar", "where", "always")]
>
> # take a peek
> head(newtea)
> names(newtea)
> str(newtea)
> cats = apply(newtea, 2, function(x) nlevels(as.factor(x)))
> cats
>
> # apply MCA
> mca1 = MCA(newtea, graph = FALSE)
>
> # list of results
> mca1
>
> # table of eigenvalues
> mca1$eig
>
> #We can use the package "ggplot2()" to get a nice plot:
> # data frame with variable coordinates
> mca1_vars_df = data.frame(mca1$var$coord, Variable = rep(names(cats), cats
> ))
>
> # data frame with observation coordinates
> mca1_obs_df = data.frame(mca1$ind$coord)
>
>
> par(cex.axis=0.5)
> # plot of variable categories
> ggplot(data=mca1_vars_df,cex.axis=0.5, cex.lab=0.5,
>        aes(x = Dim.1, y = Dim.2, label = rownames(mca1_vars_df))) +
>  geom_hline(yintercept = 0, colour = "gray70") +
>  geom_vline(xintercept = 0, colour = "gray70") +
>  geom_text(aes(colour=Variable)) +
>  ggtitle("MCA plot of variables using R package FactoMineR")
>
>
> # MCA plot of observations and categories
> ggplot(data = mca1_obs_df, aes(x = Dim.1, y = Dim.2)) +
>   geom_hline(yintercept = 0, colour = "gray70") +
>   geom_vline(xintercept = 0, colour = "gray70") +
>   geom_point(colour = "gray50", alpha = 0.7) +
>   geom_density2d(colour = "gray80") +
>   geom_text(data = mca1_vars_df,
>             aes(x = Dim.1, y = Dim.2,
>                 label = rownames(mca1_vars_df), colour = Variable)) +
>   ggtitle("MCA plot of variables using R package FactoMineR") +
>   scale_colour_discrete(name = "Variable")
>
>
> Como faço para mudar o tamanho da fonte do título, dos eixos, legenda,
> etc.? Tentei os comandos cex, cex.axis, cex.lab, mas não consegui.
>
>
> Alguém tem alguma sugestão?
>
>
>
>  [  ]'s.
> Edson Lira
> Estatístico
> Manaus-Amazonas
>
> _______________________________________________
> 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.
>



-- 
Att,

Fernando Gama da Mata

Vale of Institute Technology
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://listas.inf.ufpr.br/pipermail/r-br/attachments/20150223/6145791f/attachment.html>


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