Skip to content

Instantly share code, notes, and snippets.

@turgeonmaxime
Created April 28, 2022 20:47
Show Gist options
  • Save turgeonmaxime/69bb2b20d223b1b550459f2a52b72fea to your computer and use it in GitHub Desktop.
Save turgeonmaxime/69bb2b20d223b1b550459f2a52b72fea to your computer and use it in GitHub Desktop.
Dotplot ggplot bug?
library(tidyverse)
library(cowplot)
gg1 <- ggplot(ToothGrowth, aes(x = len)) +
geom_dotplot(aes(fill = as.factor(dose)),
binwidth = .5) +
guides(fill = FALSE)
ToothGrowth2 <- arrange(ToothGrowth, len)
gg2 <- ggplot(ToothGrowth, aes(x = len, group = factor(dose))) +
geom_dotplot(fill = as.factor(ToothGrowth2$dose),
binwidth = .5)
plot_grid(gg1, gg2)
@turgeonmaxime
Copy link
Author

turgeonmaxime commented Apr 28, 2022

The output:
image

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