gpt4 book ai didi

r - 此代码在 R 中生成一条曲线。如何更改此曲线的颜色?

转载 作者:行者123 更新时间:2023-12-04 11:05:33 24 4
gpt4 key购买 nike

此代码使用 pwr 和 ggplot2 包在 R 中生成曲线。我怎样才能改变这条曲线的颜色?

library(pwr)
library(ggplot2)
P0 = c(0.05,0.06,0.11,0.104,0.16,0.106,0.01,0.1,
0.1,0.1,0.08,0.02)
P1 = c(0.1,0.05,0.12,0.101,0.12,0.105,0.024,0.04,
0.01,0.11,0.04,0.06)
effect.size = ES.w1(P0, P1)
degrees = length(P0) - 1
pwr.chisq.test(
w=effect.size,
N=NULL,
df=degrees,
power=0.80,
sig.level=0.05)
P.out <- pwr.chisq.test(
w=effect.size,
N=NULL,
df=degrees,
power=0.80,
sig.level=0.05)
plot(P.out)
p <- plot(P.out)
p + theme_classic(base_size = 14)

最佳答案

以这种方式添加颜色信息:

plot(P.out)+ 
geom_line(colour="blue")

enter image description here

使用相同的命令,您还可以使用 HTML 颜色代码,如下所示:

  geom_line(colour="#2E64FE")

关于r - 此代码在 R 中生成一条曲线。如何更改此曲线的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50452175/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com