如何避免错误栏重叠

时间:2019-05-26 20:34:40

标签: r ggplot2

我正在尝试绘制带有误差线的线图。我已经对width和padding的值进行了所有更改,并且不能使这些条形停留在这些点上。如果我设置“躲闪”的宽度,它可以工作,但是这些点彼此之间离得太离谱了,我希望它们彼此靠近,但不要重叠。这是代码和图像。

 public class HomeController : Controller
{
    private readonly IHostingEnvironment _hostingEnvironment;

    public HomeController(IHostingEnvironment hostingEnvironment)
    {
        _hostingEnvironment = hostingEnvironment;
    }

    public ActionResult Post(Picture picture)
    {
        var pathString = configuration.GetValue<string>("UploadPaths:Pictures");
        var path = Path.Combine(_hostingEnvironment.WebRootPath, pathString, picture.Name);
        return Content(path);
    }
}

使用dodge <- position_dodge(width=.4) plot <- ggplot(data=xdata) + geom_point(mapping=aes(x=time, y=accuracy, colour=group), size=3, position=dodge) + geom_line(aes(x=time, y=accuracy, group=group, colour=group), size=1.5, position=dodge) + scale_colour_manual(values=c("black", "deepskyblue3", "firebrick3")) + scale_y_continuous(limits=c(0, 12)) + geom_errorbar(aes(x=time, ymin=accuracy - se, ymax=accuracy + se), position=position_dodge2(width=.4, padding=.2)) + ylab("proportion correct") + scale_x_discrete(labels=c("Immediate", "One day", "One week")) + xlab("")

使用width=.4

0 个答案:

没有答案