Greetings,
I am trying to create a graph where the y axis is some numeric data, the y axis is a factor group, and points represent the mean of the numeric data for each factor group. Further I need the size of the points to be scaled by the proportional number of observations in each group. This last part is where I keep getting stuck, even after hours of google searching and re-reading ggplot2 in its entirety.
Here is the code I have working...it uses the mtcars dataset which I think most people have available.
fig1 <- ggplot(mtcars, aes(cyl, mpg))
fig1 + stat_summary(fun.y = mean,
geom = "point", size = 5,
aes(group = 1), color = "red")
The only thing that is missing is that I need the size to be scaled based on the proportional number of observations in each group.
Thanks in advance,
David