library(gganatogram)library(dplyr)library(viridis)library(gridExtra)length(other_key)#> [1] 24names(other_key)
other_key[["bos_taurus"]]gganatogram(data=other_key[["bos_taurus"]], outline = T,fillOutline='white', organism="bos_taurus",sex='female', fill="colour") +theme_void() +ggtitle("bos_taurus") +theme(plot.title = element_text(hjust=0.5)) +coord_fixed()

# 定义生肖对应的物种列表chinese_zodiac <- c("bos_taurus", # 牛"gallus_gallus", # 鸡"macaca_mulatta", # 猴"rattus_norvegicus") # 鼠# 筛选出属于12生肖的物种zodiac_species <- names(other_key)[names(other_key) %in% chinese_zodiac]zodiac_key <- other_key[names(other_key) %in% chinese_zodiac]plotList <- list()for (organism in zodiac_species) {plotList[[organism]] <- gganatogram(data=zodiac_key[[organism]], outline = T, fillOutline='white', organism=organism, sex='female', fill="colour") +theme_void() +ggtitle(organism) +theme(plot.title = element_text(hjust=0.5, size=9)) +coord_fixed()}do.call(grid.arrange, c(plotList[1:4], ncol=2))

plotList <- list()for (organism innames(other_key)) {plotList[[organism]] <- gganatogram(data=other_key[[organism]], outline = T,fillOutline='white', organism=organism,sex='female', fill="colour") +theme_void() +ggtitle(organism) +theme(plot.title = element_text(hjust=0.5, size=9)) +coord_fixed()}# 将网格排列转换为图形对象grob_plot <- do.call(arrangeGrob, c(plotList[1:24], ncol=4))# 用ggsave保存为PDFggsave(filename = "other_key_ggsave.pdf",plot = grob_plot,width = 10,height = 15,device = "pdf",bg = "white")


🐎马上有福🧧
1年系统教学,实打实包教包会
每月中、月底共24节,全年无休1对1答疑
含代码、数据等完整资料包,限50人

参考
https://github.com/jespermaag/gganatogram