置信区间符号细化
confidence interval symbols refinement
我的变量 SIZ
的置信区间值非常接近于零,所以当我绘制图形时,代表平均值的圆圈与截距线重叠。
谁知道如何减小这个圆的大小或增加 X-axis
比例细化,使截距线超过 0.0000,这样它和圆之间就不会重叠?
我也想在red
中填充负值的confidence interval
符号,在blue
中填充正值。您知道我应该在脚本中添加哪些代码吗?
非常感谢
dput(read.table("clipboard",sep=";",header=TRUE))
library(ggplot2)
p <- ggplot(Dataset,aes(x=est,ymin=min, ymax=max, y=mean, shape=est))
#Added horizontal line at y=0, error bars to points and points with size two
p <- p + geom_hline(yintercept=0, size = I(1.1), color = I("red")) +
geom_errorbar(aes(ymin=min, ymax=max), width=0, color="black") +
geom_point(aes(size=2))
#Removed legends and with scale_shape_manual point shapes set to 1 and 16
p <- p + guides(size=FALSE,shape=FALSE) + scale_shape_manual(values=c(20, 20, 20, 20))
#Changed appearance of plot (black and white theme) and x and y axis labels
p <- p + theme_light() + xlab("Levels") + ylab("confident interval")
#Final adjustments of plot
p <- p + theme(axis.text.x=element_text(size=rel(1.2)),
axis.title.x=element_text(size=rel(1.3)),
axis.text.y=element_text(size=rel(1.2)),
panel.grid.minor=element_blank(),
panel.grid.major=element_blank())
#To put levels on y axis you just need to use coord_flip()
p <- p+ coord_flip()
print(p)
est min max mean
SOU -1.988 -1.893 -1.9405
EXP 0.324809225 0.354699871 0.339754548
AMOU 0.078056746 0.08289443 0.080475588
SIZ 0.009487689 0.009808696 0.009648193
要减小磅值,您必须设置较小的尺寸参数,例如
geom_point(size = 0.2)
。或者,您也可以控制线条的粗细。
对于错误栏的不同颜色尝试
geom_linerange(aes(ymin=min, ymax = mean), color="red") +
geom_linerange(aes(ymin= mean, ymax=max), color="blue")
p <- ggplot(Dataset,aes(x=est,ymin=min, ymax=max, y=mean, shape=est))
#Added horizontal line at y=0, error bars to points and points with size two
p <- p + geom_hline(yintercept=0, size = 0.2, color = 'red') +
geom_linerange(aes(ymin=min, ymax = mean), color="red") +
geom_linerange(aes(ymin= mean, ymax=max), color="blue") +
geom_point(size=0.2)
#Removed legends and with scale_shape_manual point shapes set to 1 and 16
p <- p + guides(size=FALSE,shape=FALSE) + scale_shape_manual(values=c(20, 20, 20, 20))
#Changed appearance of plot (black and white theme) and x and y axis labels
p <- p + theme_light() + xlab("Levels") + ylab("confident interval")
#Final adjustments of plot
p <- p + theme(axis.text.x=element_text(size=rel(1.2)),
axis.title.x=element_text(size=rel(1.3)),
axis.text.y=element_text(size=rel(1.2)),
panel.grid.minor=element_blank(),
panel.grid.major=element_blank())
#To put levels on y axis you just need to use coord_flip()
p <- p+ coord_flip()
p
structure(list(est = c("SOU", "EXP", "AMOU", "SIZ"), min = c(-1.988,
0.324809225, 0.078056746, 0.009487689), max = c(-1.893, 0.354699871,
0.08289443, 0.009808696), mean = c(-1.9405, 0.339754548, 0.080475588,
0.009648193)), .Names = c("est", "min", "max", "mean"), row.names = c(NA,
-4L), class = c("tbl_df", "tbl", "data.frame"))
我的变量 SIZ
的置信区间值非常接近于零,所以当我绘制图形时,代表平均值的圆圈与截距线重叠。
谁知道如何减小这个圆的大小或增加 X-axis
比例细化,使截距线超过 0.0000,这样它和圆之间就不会重叠?
我也想在red
中填充负值的confidence interval
符号,在blue
中填充正值。您知道我应该在脚本中添加哪些代码吗?
非常感谢
dput(read.table("clipboard",sep=";",header=TRUE))
library(ggplot2)
p <- ggplot(Dataset,aes(x=est,ymin=min, ymax=max, y=mean, shape=est))
#Added horizontal line at y=0, error bars to points and points with size two
p <- p + geom_hline(yintercept=0, size = I(1.1), color = I("red")) +
geom_errorbar(aes(ymin=min, ymax=max), width=0, color="black") +
geom_point(aes(size=2))
#Removed legends and with scale_shape_manual point shapes set to 1 and 16
p <- p + guides(size=FALSE,shape=FALSE) + scale_shape_manual(values=c(20, 20, 20, 20))
#Changed appearance of plot (black and white theme) and x and y axis labels
p <- p + theme_light() + xlab("Levels") + ylab("confident interval")
#Final adjustments of plot
p <- p + theme(axis.text.x=element_text(size=rel(1.2)),
axis.title.x=element_text(size=rel(1.3)),
axis.text.y=element_text(size=rel(1.2)),
panel.grid.minor=element_blank(),
panel.grid.major=element_blank())
#To put levels on y axis you just need to use coord_flip()
p <- p+ coord_flip()
print(p)
est min max mean
SOU -1.988 -1.893 -1.9405
EXP 0.324809225 0.354699871 0.339754548
AMOU 0.078056746 0.08289443 0.080475588
SIZ 0.009487689 0.009808696 0.009648193
要减小磅值,您必须设置较小的尺寸参数,例如
geom_point(size = 0.2)
。或者,您也可以控制线条的粗细。
对于错误栏的不同颜色尝试
geom_linerange(aes(ymin=min, ymax = mean), color="red") +
geom_linerange(aes(ymin= mean, ymax=max), color="blue")
p <- ggplot(Dataset,aes(x=est,ymin=min, ymax=max, y=mean, shape=est))
#Added horizontal line at y=0, error bars to points and points with size two
p <- p + geom_hline(yintercept=0, size = 0.2, color = 'red') +
geom_linerange(aes(ymin=min, ymax = mean), color="red") +
geom_linerange(aes(ymin= mean, ymax=max), color="blue") +
geom_point(size=0.2)
#Removed legends and with scale_shape_manual point shapes set to 1 and 16
p <- p + guides(size=FALSE,shape=FALSE) + scale_shape_manual(values=c(20, 20, 20, 20))
#Changed appearance of plot (black and white theme) and x and y axis labels
p <- p + theme_light() + xlab("Levels") + ylab("confident interval")
#Final adjustments of plot
p <- p + theme(axis.text.x=element_text(size=rel(1.2)),
axis.title.x=element_text(size=rel(1.3)),
axis.text.y=element_text(size=rel(1.2)),
panel.grid.minor=element_blank(),
panel.grid.major=element_blank())
#To put levels on y axis you just need to use coord_flip()
p <- p+ coord_flip()
p
structure(list(est = c("SOU", "EXP", "AMOU", "SIZ"), min = c(-1.988,
0.324809225, 0.078056746, 0.009487689), max = c(-1.893, 0.354699871,
0.08289443, 0.009808696), mean = c(-1.9405, 0.339754548, 0.080475588,
0.009648193)), .Names = c("est", "min", "max", "mean"), row.names = c(NA,
-4L), class = c("tbl_df", "tbl", "data.frame"))