Skip to content

Instantly share code, notes, and snippets.

@gorkang
Created May 13, 2021 14:04
Show Gist options
  • Save gorkang/498d320b862efbd5040ee50acf19dfd8 to your computer and use it in GitHub Desktop.
Save gorkang/498d320b862efbd5040ee50acf19dfd8 to your computer and use it in GitHub Desktop.
library(tidyverse)
DF = tibble(country = c("a", "a", "b", "b", "b"),
value = c(1, 1.01, 2, 2.01, 2),
size_dot = c(4, 2, 1, 3, 6))
plot1 = ggplot(DF, aes(value, country, fill = country)) +
geom_point(aes(size = size_dot), shape = 21, alpha = .5, position = position_dodge2(width = .2))#position_jitterdodge(seed = 5))
plot2 = ggplot(DF, aes(value, country, fill = country)) +
geom_point(aes(size = size_dot), shape = 21, alpha = .5, position = position_jitterdodge(jitter.width = .07, jitter.height = .05, seed = 5))
plot3 = ggplot(DF, aes(value, country, fill = country)) +
geom_jitter(aes(size = size_dot), shape = 21, alpha = .5, width = .07, height = .05)
ggsave("plot1.png", plot1)
ggsave("plot2.png", plot2)
ggsave("plot3.png", plot3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment