图片来源于新英格兰医学杂志文章:https://www.nejm.org/doi/full/10.1056/NEJMoa1715944
Ref: Witztum, J. L., Gaudet, D., Freedman, S. D., Alexander, V. J., Digenio, A., Williams, K. R., … Bruckert, E. (2019). Volanesorsen and Triglyceride Levels in Familial Chylomicronemia Syndrome. New England Journal of Medicine, 381(6), 531–542.
imagePlacebo相对于baseline增加了18%,而Volanesorsen组相对于baseline减少了77%。
代码:
group <- rep(c('placebo', 'Volanesorsen'),each = 10)
set.seed(1)
placebo <- rnorm(10, mean = 18, sd = 22)
set.seed(2)
Volanesorsen <- rnorm(10, mean = -77, sd = 14)
data <- data.frame(group, value = append(placebo, Volanesorsen))
table <- data %>%
group_by(group) %>%
summarize(
Mean = mean(value),
sd = sd(value)
)
x = ggplot() +
geom_bar(table,
mapping = aes(x = group, y = Mean),
fill = c('darkred','gray'),
stat="identity",
width = 0.4) +
geom_errorbar(table, mapping = aes(x = group, ymin=Mean-sd, ymax=Mean+sd),
width=.05,
size = 0.25,# 设置误差线的宽度
position=position_dodge(.9))+
geom_text(table, mapping = aes(x = "placebo", y = 40, label = 18), size = 3)+
geom_text(table, mapping = aes(x = "Volanesorsen", y = -100, label = -77), size = 3)+
scale_y_continuous(breaks = seq(-110,60, by = 20))+
labs(
x = "",
y = "percentage change from baseline"
)+
theme_classic()
y = x +geom_hline(yintercept = 0, linetype =3, color = 'grey') +
theme(axis.line = element_line(size=0.4, colour = 'grey'),
axis.text=element_text(size=8,colour="black"))
tiff("fig.tiff", res = 300, width = 800, height = 1200)
y
dev.off()
结果如图:
image.png
网友评论