Created
November 17, 2024 05:29
-
-
Save abikoushi/3e668a5a15aff62de65d1c57867ddfd9 to your computer and use it in GitHub Desktop.
Parallel coordinate plot with jitter
This file contains hidden or 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(dplyr) | |
| library(tidyr) | |
| library(ggplot2) | |
| df1 <- mutate(iris, id=1:n()) %>% | |
| pivot_longer(1:4) | |
| ggplot(df1,aes(x=name,y=value,group=id, colour = Species))+ | |
| geom_line(alpha=0.5)+ | |
| guides(colour=guide_legend(override.aes = list(alpha=1, linewidth=1)))+ | |
| scale_color_brewer(palette = "Set2")+ | |
| theme_bw(16) | |
| ggsave("iden_x.png") | |
| ggplot(df1,aes(x=name,y=value,group=id, colour = Species))+ | |
| geom_line(alpha=0.5, position = position_jitter(width=0.2, height = 0, seed = 123))+ | |
| guides(colour=guide_legend(override.aes = list(alpha=1, linewidth=1)))+ | |
| scale_color_brewer(palette = "Set2")+ | |
| theme_bw(16) | |
| ggsave("jitter_x.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment