2
I need to generate a bar graph with the following data:
structure(c(38792L, 1227L, 23220L, 4177L, 893L, 331L), .Dim = 6L, .Dimnames = structure(list(c("Canvas para Android", "Canvas para iOS", "Chrome ", "Firefox ", "Navegador não reconhecido", "Safari ")), .Names = ""), class = "table")
I need to group the bars of "Canvas for Android" and "Canvas for iOS", just below them I should put a label "Mobile device" and also need to group the other bars adding a logo "Computer".
I made the chart as follows:
AgUsuPlot<- barplot(table(AgenteDoUsuario[,1]),
main = "Distribuição de Frequência do Agente do Usuário",
ylim = c(0,45000),
xlab="Agente do Usuário",
col = c("palegreen", "green", "orange", "darkred", "red", "darkblue"),
ylab="Exibições de Páginas",
legend = rownames(table(AgenteDoUsuario[,1])),
cex.axis = 0.6,
cex.names = 0.6,
space = 0.5,
las=1
)
text(x=AgUsuPlot, y=table(AgenteDoUsuario[,1]), label=table(AgenteDoUsuario[,1]), pos = 3, xpd=NA)
I wonder how I can diminish the legend, because it is standing on top of one of the bars.
Perfect Rafael! All commands worked beautifully!
– Fábio Junio Alves Sousa
Thanks a lot! The first command
mtext
I was showing the old labels, I made small changes to your code and the chart was the way I wanted it! Thank you Rafael! You’re saving my TCC rsrs.– Fábio Junio Alves Sousa
I’m glad it worked out. Consider vote and accept my answer if she solved your problem
– Rafael Cunha