Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ggrarecurve()不能按照样本的分组着色 #21

Closed
wangzhichao1990 opened this issue Nov 10, 2020 · 3 comments
Closed

ggrarecurve()不能按照样本的分组着色 #21

wangzhichao1990 opened this issue Nov 10, 2020 · 3 comments

Comments

@wangzhichao1990
Copy link

@xiangpin 你好
好像ggrarecurve()不能按照样本的分组着色,只能从图中提取data重新绘制。
代码:

p <- ggrarecurve(obj = ps_qiime2)
data <- p$data
ggplot(data, aes(readsNums, value, color = group, group = sample))+
  geom_smooth(se = FALSE, method = "lm", formula = y~log(x))

你会增加这个功能吗?谢谢。

@xiangpin
Copy link
Member

please refer #10

or the workshop

@wangzhichao1990
Copy link
Author

抱歉,我没说明白我的意图。
我是说曲线还是按照样本绘制,着色按照分组来,就像下面的例子一样。

# for reproducibly random number
set.seed(1024)
p_rare <- ggrarecurve(obj=ps,
                      indexNames=c("Observe","Chao1","ACE"),
                      chunks=400) +
  theme(legend.spacing.y=unit(0.01,"cm"),
        legend.text=element_text(size=4))

p_rare

data <- p_rare$data
ggplot(data, aes(readsNums, value, color = Class, group = sample))+
  geom_smooth(se = FALSE, method = "lm", formula = y~log(x)) +
  facet_wrap(~ Alpha, scales="free") +
  ylab("alpha metric")+xlab("number of reads")

res

@xiangpin
Copy link
Member

最新版本github已经支持这个功能

p_rare <- ggrarecurve(obj=ps,
                      shadow=FALSE,
                      factorNames="Class",
                      indexNames=c("Observe","Chao1","ACE"),
                      chunks=400) +
  theme(legend.spacing.y=unit(0.01,"cm"),
        legend.text=element_text(size=4))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants