R geom_点不是真正的空心,错误条重叠

R geom_点不是真正的空心,错误条重叠,r,ggplot2,R,Ggplot2,这在我看来可能是一个非常愚蠢的错误,但每当我根据一个因子指定几何点,然后选择一个空心点和一个实心点(形状1和19),并绘制错误条时,它就会穿过该点 以下是我的数据帧: > dput(head(allbins.sum)) structure(list(T = c(0L, 0L, 10L, 10L, 20L, 20L), treatment = structure(c(1L, 2L, 1L, 2L, 1L, 2L), .Label = c("control bead", "dP bead")

这在我看来可能是一个非常愚蠢的错误,但每当我根据一个因子指定几何点,然后选择一个空心点和一个实心点(形状1和19),并绘制错误条时,它就会穿过该点

以下是我的数据帧:

> dput(head(allbins.sum))
structure(list(T = c(0L, 0L, 10L, 10L, 20L, 20L), treatment = structure(c(1L, 
2L, 1L, 2L, 1L, 2L), .Label = c("control bead", "dP bead"), class = "factor"), 
    N = c(3, 3, 3, 3, 3, 3), cellsBase = c(0, 0, 0.013028995209506, 
    0.135599858885737, -0.0130289952095061, 0.759359209760127
    ), sd = c(0, 0, 0.0597063567767786, 0.0469731690178533, 0.0983667566897066, 
    0.183436089048999), se = c(0, 0, 0.034471481157405, 0.0271199717771474, 
    0.0567920734541125, 0.105906875391532), ci = c(0, 0, 0.148318812500416, 
    0.116687820597672, 0.244356569875469, 0.455680506502609), 
    bin = c("BinA", "BinA", "BinA", "BinA", "BinA", "BinA")), .Names = c("T", 
"treatment", "N", "cellsBase", "sd", "se", "ci", "bin"), row.names = c(NA, 
6L), class = "data.frame")

> dput(head(allbins.fitdata))
structure(list(wellvidbin = structure(c(1L, 1L, 1L, 1L, 1L, 1L
), .Label = c("A1-002-BinA", "A1-002-BinB", "A1-002-BinC", "A1-031-BinA", 
"A1-031-BinB", "A1-031-BinC", "A3-004-BinA", "A3-004-BinB", "A3-004-BinC", 
"B1-032-BinA", "B1-032-BinB", "B1-032-BinC", "B4-026-BinA", "B4-026-BinB", 
"B4-026-BinC", "C4-027-BinA", "C4-027-BinB", "C4-027-BinC"), class = "factor"), 
    treatment = structure(c(2L, 2L, 2L, 2L, 2L, 2L), .Label = c("control bead", 
    "dP bead"), class = "factor"), wellvid = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("A1-002", "A1-031", "A3-004", 
    "B1-032", "B4-026", "C4-027"), class = "factor"), bin = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L), .Label = c("BinA", "BinB", "BinC"), class = "factor"), 
    T = c(0L, 10L, 20L, 30L, 40L, 50L), T.factor = structure(1:6, .Label = c("0", 
    "10", "20", "30", "40", "50", "60"), class = "factor"), cells = c(7L, 
    11L, 26L, 27L, 28L, 36L), cellsS = c(-1.36568429306349, -1.20296446240061, 
    -0.592765097414793, -0.552085139749072, -0.511405182083351, 
    -0.185965520757582), cellsBase = c(0, 0.162719830662884, 
    0.772919195648701, 0.813599153314422, 0.854279110980143, 
    1.17971877230591), treatT = structure(c(2L, 4L, 6L, 8L, 10L, 
    12L), .Label = c("control bead.0", "P bead.0", "control bead.10", 
    "P bead.10", "control bead.20", "P bead.20", "control bead.30", 
    "P bead.30", "control bead.40", "P bead.40", "control bead.50", 
    "P bead.50", "control bead.60", "P bead.60"), class = "factor"), 
    fit = c(0.0285939715820639, 0.304399288764407, 0.58020460594675, 
    0.856009923129092, 1.13181524031144, 1.40762055749378), se.fit = c(0.157415367032567, 
    0.132348142293459, 0.114707848741265, 0.108190467052118, 
    0.114707848741265, 0.132348142293459), upr = c(0.337128090965895, 
    0.563801647659587, 0.805031989479629, 1.06806323855124, 1.35664262384431, 
    1.66702291638896), lwr = c(-0.279940147801767, 0.0449969298692267, 
    0.35537722241387, 0.643956607706942, 0.906987856778556, 1.1482181985986
    )), .Names = c("wellvidbin", "treatment", "wellvid", "bin", 
"T", "T.factor", "cells", "cellsS", "cellsBase", "treatT", "fit", 
"se.fit", "upr", "lwr"), class = c("data.table", "data.frame"
), row.names = c(NA, -6L), .internal.selfref = <pointer: 0x0000000000100788>)
这给了我这样一个情节:

有没有关于如何将空心圆挖空的提示? 我还尝试指定
geom\u形状(aes(fill=treatment)
,然后指定
scale\u fill\u手册
,但它也适用于我的
geom\u平滑


感谢您的帮助!

如果您的意思是不希望错误条的线条通过“空心”点可见,则首先绘制
geom_错误条
,然后绘制
geom_点
第二个实心填充,这样它将覆盖错误条

ggplot(data=allbins.sum, aes(x=T, y=cellsBase)) + 
  # plotting this first
  geom_errorbar(aes(ymin=cellsBase-se, ymax=cellsBase+se), width=2, size=1) +

  # plotting this second, with a hollow fillable shape, and black outline
  geom_point(size=5, shape = 21, color='black',
             aes(fill = treatment)) +

  # solid black and solid white fill for the points
  scale_fill_manual(values = c('black', 'white')) +
  theme_bw()


(您发布的数据只有
allbins.sum
的这些点,而
allbins.fitdata
的代码有错误,因此此图上没有错误条)

如果您的意思是不希望错误条的线条通过“空心”点可见,则首先绘制
geom\u错误条
,然后绘制
geom\u点
第二个实心填充,这样它将覆盖错误条

ggplot(data=allbins.sum, aes(x=T, y=cellsBase)) + 
  # plotting this first
  geom_errorbar(aes(ymin=cellsBase-se, ymax=cellsBase+se), width=2, size=1) +

  # plotting this second, with a hollow fillable shape, and black outline
  geom_point(size=5, shape = 21, color='black',
             aes(fill = treatment)) +

  # solid black and solid white fill for the points
  scale_fill_manual(values = c('black', 'white')) +
  theme_bw()


(您发布的数据只有
allbins.sum
的这些点,而
allbins.fitdata
的代码有错误,因此此图上没有错误条)

您所说的“空心圆要挖空”是什么意思?它们还不够空心吗?你所说的“空心圆要挖空”是什么意思?它们还不够空心吗?我完全忘记了ggplot是按层添加几何图形的!谢谢!这也与这个问题有关:形状21:25允许填充美学,而1:14具有透明背景,15:20是由“颜色”定义的实心形状。这个问题似乎已经通过将形状更改为21并使用“白/黑”来解决填充,而不是层的顺序。如果您不希望错误条在点内可见,则上述层的顺序也是必要的。我完全忘记了ggplot按层添加几何图形!谢谢!也与此问题相关:形状21:25允许填充美学,而1:14具有透明背景,15:20是实心形状定义用“颜色”填充。通过使用“白色/黑色”填充将形状更改为21,而不是图层的顺序,似乎解决了此问题。如果您不希望错误条在点内可见,则也需要按上述顺序排列图层。