Skip to content

Instantly share code, notes, and snippets.

@arvi1000
Created November 8, 2016 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arvi1000/0f958cf342c5ff054bddf5b43380453a to your computer and use it in GitHub Desktop.
Save arvi1000/0f958cf342c5ff054bddf5b43380453a to your computer and use it in GitHub Desktop.
sometimes you just want to visualize a quantity; this shows a given number of dots
# sometimes you just want to visualize a quantity; this shows a given number of dots
library(ggplot2)
library(magrittr)
dot_count <- 300
size <- ceiling(dot_count^.5)
data.frame(x = rep(1:size, each=size),
y = rep(size:1, size),
clr = sample(letters[1:6], size^2, replace=T),
id = 1:(size^2)) %>%
subset(id <= dot_count) %>%
ggplot(aes(x,y, color=clr)) +
#geom_point(size=4, show.legend = F) + # neat version
geom_jitter(size=4, show.legend = F, alpha=0.8) + # jitter version
scale_color_brewer(type='qual', palette='Set1') +
theme_void()
@arvi1000
Copy link
Author

arvi1000 commented Nov 8, 2016

image

@arvi1000
Copy link
Author

arvi1000 commented Nov 8, 2016

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment