ggplot2 - 生存游泳者情节不显示排序值

时间:2017-08-11 17:04:07

标签: r plot ggplot2

使用this问题我已经组装了一个定制的游泳池,但是尽管我已经通过Therapy.Length对患者进行了分类,当我尝试绘制它时,下半部分的酒吧经常会出现很多比他们应该的更长 - 把图表排除在外。

The Swimmer Plot with incorrect bar lengths

我已经检查过,即使酒吧太长,符号也在正确的位置,所以条形长度不断扩大。通过注释IP_ADD_MEMBERSHIP块,我能够在条上获得适当的长度,但随后所有符号放置都被压缩。

scale_y_continuous

以下是代码的其余部分:[x]

解答: ggplot(dat, aes(Patient.ID, Therapy.Length)) + geom_bar(stat="identity", aes(fill=factor(Disease.Stage)), width=0.7) + geom_point(data=dat, aes(Patient.ID, value, colour=variable, shape=variable), size=4) + geom_segment(data=dat %>% filter(Continued == 1), aes(x=Patient.ID, xend=Patient.ID, y=Therapy.Length + 0.1, yend=Therapy.Length + 20), arrow=arrow(type="closed", length=unit(0.13,"in"))) + coord_flip() + scale_fill_manual(values=hcl(seq(15,375,length.out=5)[1:4],100,70)) + scale_colour_manual(values=c(hcl(seq(15,375,length.out=3)[1:2],100,40),c("black","darkgreen"))) + scale_y_continuous(limits=c(-1,max(dat$Therapy.Length)), breaks=seq(0,max(dat$Therapy.Length),30)) + labs(fill="Disease Stage", colour="", shape="", x="Subject Received Study Drug") + theme_bw() + theme(panel.grid.minor=element_blank(),panel.grid.major=element_blank(), axis.text.y=element_blank(),axis.ticks.y=element_blank()) 最初已融化 - 已将dat更改为未融合(并创建为dat为融化版本),并将dat.m提供给dat.m和{{ 1}}用于向条形图添加点。

数据:

geom_point

0 个答案:

没有答案