I'm currently mapping out values as Geoms on ggplot. These values are on the y axis and their categories are on the x axis.
Data looks something like this:
Value condition
1 TRUE
1 TRUE
1 TRUE
6 TRUE
10 TRUE
Minimal running example:
df <- data.frame(c(1,1,1,1,1,2,3,3,1,6), TRUE)
colnames(df) <- c("value", "condition")
ggplot(df, aes(x = condition, y = value)) + geom_point()
So for instance, at value 1 under condition TRUE, how could I make the dot (or whatever shape) larger than the others, as it has a larger number of data points there.
6 ones has more data points than 3 threes or 1 two or 1 six. So one would be the biggest in this example, 3 would be next, while 2 and 6 would be the same size
Using the dplyr package, you can reshape your data. Then, you can draw a figure.
mydf <- data.frame(c(1,1,1,1,1,1,2,3,3,1,6), TRUE)
colnames(mydf) <- c("value", "condition")
library(dplyr)
count(mydf, condition, value) -> mydf2
ggplot(mydf2, aes(x = condition, y = value, size = n)) + geom_point()

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With