{"id":283,"date":"2022-01-24T10:38:01","date_gmt":"2022-01-24T02:38:01","guid":{"rendered":"https:\/\/linguopeng.top\/?p=283"},"modified":"2022-01-24T10:38:03","modified_gmt":"2022-01-24T02:38:03","slug":"%e7%82%b9%e5%9b%be","status":"publish","type":"post","link":"https:\/\/linguopeng.top\/?p=283","title":{"rendered":"\u70b9\u56fe"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>library(tidyverse)\nlibrary(ggsci)\ndf &lt;- read_csv(\"data.csv\")\np &lt;- read_tsv(\"group.xls\") %>% left_join(.,df,by=\"sample\") %>% \n  unite(.,col=\"group\",group1:group2,sep=\"_\",remove = T,na.rm = F) %>% \n  pivot_longer(Shannon.Wiener:pielou) %>% select(-sample)\np %>% ggplot(aes(x = group, y =value,fill =group,group=1)) +\n  stat_summary(fun.data=\"mean_cl_normal\",geom=\"errorbar\",width=0.2) +\n  stat_summary(fun = \"mean\",geom = \"point\",size=5,pch=21)+\n  stat_summary(fun = \"mean\", geom = \"line\",size=0.5)+\n  annotate(\"rect\",xmin=\"Control_A\",xmax=\"Control_B\",ymin=-Inf,ymax=Inf,alpha=0.3,fill=\"grey\")+\n  facet_wrap(.~name,scales = \"free\",labeller = label_wrap_gen(),nrow = 2)+\n  scale_fill_npg()+\n  theme_test()+\n  theme(panel.spacing.x = unit(0.2,\"cm\"),\n        panel.spacing.y = unit(0.1, \"cm\"),\n        axis.title = element_blank(),\n        strip.text.x = element_text(size=9,color=\"black\"),\n        axis.text = element_text(color=\"black\"),\n        axis.text.x=element_blank(),\n        axis.ticks.x=element_blank(),\n        legend.text = element_text(color=\"black\",size=9),\n        legend.title=element_blank(),\n        legend.spacing.x=unit(0.1,'cm'),\n        legend.key=element_blank(),\n        legend.key.width=unit(0.4,'cm'),\n        legend.key.height=unit(0.4,'cm'),\n        legend.position = \"top\",\n        plot.margin=unit(c(0.3,0.3,0.3,0.3),units=,\"cm\"))+\n  guides(fill = guide_legend(direction = \"horizontal\"))+\n  guides(fill=guide_legend(nrow=1, byrow=TRUE))\n\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/linguopeng.top\/wp-content\/uploads\/2022\/01\/Rplot01-1.png'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"442\" height=\"500\" data-original=\"https:\/\/linguopeng.top\/wp-content\/uploads\/2022\/01\/Rplot01-1.png\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-284\"\/><\/div><\/figure>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-283","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts\/283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=283"}],"version-history":[{"count":1,"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts\/283\/revisions"}],"predecessor-version":[{"id":285,"href":"https:\/\/linguopeng.top\/index.php?rest_route=\/wp\/v2\/posts\/283\/revisions\/285"}],"wp:attachment":[{"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linguopeng.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}