简体   繁体   English

为什么我不能在 ggplot 中生成 CI 的最小值和最大值?

[英]Why can't I produce the min and max value of the CI in ggplot?

I want to draw a ggplot with geom_errorbar, normally min and max value of the CI is produced automatically, but I can't get it.我想用 geom_errorbar 绘制一个 ggplot,通常 CI 的最小值和最大值是自动生成的,但我无法得到它。 See the the codes below and expected part of the graph which is showed in the red circle.请参阅下面的代码和红色圆圈中显示的图表的预期部分。

df14<-data.frame(size=c(1750,2000,2500,3000,1750,2000,2500,3000),
                 ratio=c(1.41,1.35,1.29,1.48,2.03,2.12,2.31,1.96),
                 IQ   =c( "M","M","M","M","F",
                          "F","F","F"))



ggplot(df14, aes(x= size, y=ratio, colour=IQ)) + 
  geom_errorbar(aes(ymin=ratio-0.05, ymax=ratio+0.05), colour="black", width=.1) +
  geom_line( ) +
  geom_point( )

在此处输入图像描述

Just leave the width out - or try it with a larger width.只需保留宽度 - 或尝试使用更大的宽度。 Or do you mean something else, when you say how can I make the errobar smaller ?或者你的意思是别的什么,当你说我怎样才能让 errobar 变小

library(ggplot2)

ggplot(df14, aes(x= size, y=ratio, colour=as.factor(IQ))) + 
  geom_errorbar(aes(ymin=ratio-0.05, ymax=ratio+0.05), 
                width = 50, colour="black") +
  geom_line( ) +
  geom_point( )

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我在 ggplot2 中的情节图例没有显示最小值和最大值? 它显示的是连续值,但不是最大值和最小值? - Why my plot's legend in ggplot2, doesn't show minimum and maximum value? It is showing a continuous value but not max and min? 我可以计算行或列的最小值或最大值,我可以计算列的平均值,但我无法计算行的平均值。 为什么不? - I can calculate the min or max of a row or column and I can calculate the mean of a column, but I can't calculate the mean of a row. Why not? R - 如何使用 ggplot2 为我的散点图的最大值和最小值点着色和 label? - R - How can I color and label the max and min values points of my scatterplot using ggplot2? 如何使用ggplot2生成此图形 - How can I produce this graph with ggplot2 如何在 r ggplot 中包含特定变量的最小值和最大值 - How to include min and max value pf a particular variable in r ggplot 有没有办法在ggplot中将x轴设置为最小值和最大值? - Is there a way to set the x-axis to min and max value in ggplot? ggplot set ylim min OR max - ggplot set ylim min OR max 在 R 中使用 ggplot2,如何在各自的点上打印 min、q1、mean、median、q3、max 值? - Using ggplot2 in R, how can I also print min, q1, mean, median, q3, max values on their respective points? 如何过滤一组中的最大值和另一组中的最小值? - How can I filter max value in a group and min value in another group? 无法让 ggplot 生成 geom_line - Can't get ggplot to produce a geom_line
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM