Hi all, I need your help.
I need to plot a graphic like the one below.
I was looking on info for it, and I've found that I needed a long data frame.
This is my data:
#####################################################
z <- structure(list(anuncios = structure(c(2L, 1L, 2L, 1L),
.Label = c("PPA1 - Carnes",
"PPA2 - Pastas"), class = "factor"), acciones = structure(c(1L,
1L, 2L, 2L), .Label = c("comentarios", "compartidos"), class = "factor"),
cantidad = c(131L, 125L, 120L, 69L)),
row.names = c(NA, -4L
),
.Names = c("anuncios", "acciones", "cantidad"),
class = "data.frame")
########################################################
Code:
I've tried this:
ggplot(z, aes(x=factor(anuncios), fill=factor(acciones))) +
geom_bar(position="dodge")
But that didn't work as I expecter, both bars are the same hight:
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ggp...@googlegroups.com
To unsubscribe: email ggplot2+u...@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<barras.png>
ggplot(z,aes(x=anuncios,y=cantidad, fill=acciones)) +
geom_bar(stat="identity",position="dodge”)