Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created November 17, 2024 05:29
Show Gist options
  • Select an option

  • Save abikoushi/3e668a5a15aff62de65d1c57867ddfd9 to your computer and use it in GitHub Desktop.

Select an option

Save abikoushi/3e668a5a15aff62de65d1c57867ddfd9 to your computer and use it in GitHub Desktop.
Parallel coordinate plot with jitter
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