2021年1月2日星期六

ggplot not seperating by value - Violin Plot

I am trying to create a violin plot with genotype on the x axis and age on the y axis.

My data.frame (df1) looks like this:

ID Deletion1 Deletion2 Age  1  WT        Homo      40  2  Het       WT        30  3  Homo      Het       60  

I tried:

ggplot(df1, aes(x='Deletion1', y=Age)) + geom_violin(trim=FALSE)  

Where I also changed the values of age, Deletion1, and Deletion2 to factors. But instead of creating a plot with 3 violins (WT, Het, Homo), it creates one labeled '16kb'

I also tried changed Wt, Het, Homo to 0, 1, 2 but I get the same behavior, I dont know why

https://stackoverflow.com/questions/65545971/ggplot-not-seperating-by-value-violin-plot January 03, 2021 at 09:58AM

没有评论:

发表评论