Home > Mobile >  How to solve the issue of the group title being cut off?
How to solve the issue of the group title being cut off?

Time:10-31

this is my first time to ask questions in stack overflow. Recently I have done a bit of data visualization on the Amino Acids by making a multiple pie charts First, this is my dataset

library(ggplot2)
df = data.frame(Species <-c('Chicken','Chicken','Chicken','Chicken','Chicken','Human','Human','Human','Human','Human','Crab-eating macaque','Crab-eating macaque','Crab-eating macaque','Crab-eating macaque','Crab-eating macaque','Mouse','Mouse','Mouse','Mouse','Mouse','Zebrafish','Zebrafish','Zebrafish','Zebrafish','Zebrafish'),
                Amino_acids <- c('E','R','G','P','Others','E','R','G','P','Others','E','R','G','P','Others','E','R','G','P','Others','E','R','G','P','Others'),
                value <- c(18,6,10,9,57,26,14,8,5,46,29,15,10,4,42,23,17,7,5,48,31,4,13,7,46))

df$Species <- factor(df$Species)
df$Amino_acids <- factor(df$Amino_acids) 

Then, using ggplot2 to make the data visualization

ggplot(data=df, aes(x=" ", y=value, group=Amino_acids, colour=Amino_acids, fill=Amino_acids))  
  geom_bar(width = 1, stat = "identity", position= "fill")  
  coord_polar("y", start=0) 
  facet_grid(.~ Species)   facet_wrap(.~Species, strip.position="top") theme_void()

and the result is this enter image description here

  • Related