0

我想绘制下面的图表或与之非常相似的东西,我有完全相同的数据,但我只是不知道如何做到这一点。有人可以帮我写代码吗?

在此处输入图像描述

到目前为止,我设法使用以下代码获得了下图:

  ggplot(DCE,aes(x=Level,y=Marginal))+
  geom_point()+
  geom_line(aes(group=Attribute))+  ## connect subjects with a line
  facet_grid(.~Attribute)+        ## 1 row of panels by roost
  zero_margin+                        ## squash together
  theme(axis.text.x = element_text(angle = 90))

在此处输入图像描述

但我只需要在某些方面显示一些变量,例如:

在此处输入图像描述

如何将它们分组到正确的方面?

这是我的数据:

> str(DCE)
tibble [13 x 6] (S3: tbl_df/tbl/data.frame)
 $ Attribute : chr [1:13] "5-year progression free survival" "5-year progression free survival" "5-year progression free survival" "5-year progression free survival" ...
 $ Level     : chr [1:13] "0.5" "0.6" "0.65" "0.7" ...
 $ Marginal  : num [1:13] 0 0.12 0.17 0.26 0 0.08 0 -0.11 -0.02 0 ...
 $ marginLow : num [1:13] NA 0.07 0.14 0.23 NA 0.05 NA -0.14 -0.06 NA ...
 $ MarginHigh: num [1:13] NA 0.17 0.21 0.3 NA 0.1 NA -0.07 -0.01 NA ...
 $ subject   : num [1:13] 1 1 1 1 2 2 3 3 3 4 ...
> 
4

0 回答 0