缺少 x 值的 ggplot 散点图,趋势线不会连接

时间:2021-07-31 20:21:35

标签: r ggplot2 scatter-plot trendline

我是 R 新手,我正在尝试使用 ggplot2 将一些数据绘制为散点图。我的样本中缺少一天,我制作的趋势线无法将所有数据连接在一起。下面是我的代码和图表的样子。

ggplot(SiExptTEPa, aes(x=Timepoint..dpi., y=(TEPcells),group=(Treatment))) +
    geom_point(size=5,aes(colour=Nutrient)) +
    scale_color_manual(values=c('yellow','light blue')) +
    geom_errorbar(aes(ymin=TEPcells-se, ymax=TEPcells+se), width=.1) +
    facet_wrap(~Nutrient, scales="free") +
    scale_y_continuous(labels = scientific) +
    theme_classic() +
    xlab("Time Post Infection (Days)") +
    ylab("TEP by Total Cells") +
    ylim(3e-08,2e-07) +
    geom_line(aes(linetype=Treatment)) +
    scale_linetype_manual(values=c("solid", "dashed"))

Incorrect graph

请告诉我如何连接图形两侧中间的间隙,使之成为一条连续的线?

0 个答案:

没有答案
相关问题