[英]Change the color of a confidence interval band?
I am using the blandr package to make a Bland & Altman plots, and the confidence intervals are surely something that I want to plot:我正在使用 blandr package 制作 Bland & Altman 图,置信区间肯定是我想要的 plot:
library(blandr)
x1 <- rnorm(100);x2 <- rnorm(100,mean = 1)
blandr.draw(x1,x2, ciShading = TRUE,ciDisplay=TRUE,plotter = "ggplot")
I would prefer to change the color of the confidence intervals.我更愿意更改置信区间的颜色。 They do not respond to any change in fill color as far as I can tell.
据我所知,它们不会对填充颜色的任何变化做出反应。 What can I do?
我能做些什么?
blandr
creates a ggplot object, so you can modify the colors with the ggplot_build
method. blandr
创建了一个 ggplot object,因此您可以使用ggplot_build
方法修改 colors。
library(blandr)
library(ggplot2)
x1 <- rnorm(100);x2 <- rnorm(100,mean = 1)
p <-
blandr.draw(x1, x2, ciShading = TRUE, ciDisplay=TRUE, plotter = "ggplot")
p_build <- ggplot_build(p)
#> Warning: Use of `plot.data$x.axis` is discouraged. Use `x.axis` instead.
#> Warning: Use of `plot.data$y.axis` is discouraged. Use `y.axis` instead.
p_build$data[[12]][["fill"]] <- "grey"
p_build$data[[13]][["fill"]] <- "steelblue"
p_build$data[[14]][["fill"]] <- "thistle"
grid::grid.draw(ggplot_gtable(p_build))
Created on 2021-06-11 by the reprex package (v2.0.0)由代表 package (v2.0.0) 于 2021 年 6 月 11 日创建
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.