【发布时间】:2021-02-28 14:06:29
【问题描述】:
我正在使用简单的逻辑回归并使用 ggplot 进行漂亮的演示。我修改了这段代码1 来创建运行良好的情节。 现在,我的一些垃圾箱重叠了2,我想在垃圾箱周围添加边框以便更清晰地展示。
在使用geom_segment 时如何为垃圾箱添加边框?
ggplot() +
geom_segment(data=H1, size=7, show.legend=FALSE,
aes(x=SAL, xend=SAL, y=HG, yend=pct, color=factor(HG))) +
geom_point() +
stat_smooth(method="glm", se= FALSE, method.args = list(family =
"binomial"),
aes(x=SAL, y=HG),
data = mydata) +
labs(x="Salinity [‰]", y="Predicted probability")+
scale_y_continuous(limits=c(-0.02,1.02)) +
scale_x_continuous(limits=c(7,28)) +
theme_bw(base_size=13.5)
【问题讨论】:
-
你能用
geom_rect代替吗?那么你可以使用填充+颜色。我不认为你可以在不做一些非正统的事情的情况下使用 geom_segment 添加边框。
标签: r ggplot2 histogram logistic-regression