Created
April 28, 2022 20:47
-
-
Save turgeonmaxime/69bb2b20d223b1b550459f2a52b72fea to your computer and use it in GitHub Desktop.
Dotplot ggplot bug?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The output:
![image](https://user-images.githubusercontent.com/6857788/165843027-1b41bf24-c7ab-4379-8abf-d6f1198cc37a.png)