ggplot:删除功能区边缘上的线 [英] ggplot: remove lines at ribbon edges
本文介绍了ggplot:删除功能区边缘上的线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用ggplot
绘制时程数据(随时间变化的固定比例到屏幕上的不同对象),并希望使用功能区显示SE,但是功能区本身在顶部和底部边缘都有线条,这使得读取图形更加困难.我还无法弄清楚如何消除那些边缘线.这是我的情节代码:
I am using ggplot
to plot time course data (fixation proportions over time to different objects on the screen) and want to use a ribbon to show the SE, but the ribbon itself has lines at the top and bottom edges, which makes reading the graph a bit harder. I haven't been able to figure out how to get rid of those edge lines. Here is my plot code:
ggplot(d, aes(Time, y, color = Object, fill = Object)) +
stat_summary(fun.y = "mean", geom = "line", size = 2) +
stat_summary(fun.data = "mean_se", geom = "ribbon", alpha = .3)
有什么建议吗?
这是一个最小的工作示例.我已将数据压缩为:
Here is a minimal working example. I've compressed my data to:
Time Object y lower upper
1 1000 C 0.12453389 0.04510504 0.2039627
2 1000 T 0.58826856 0.37615078 0.8003864
3 1000 U 0.09437160 0.03278069 0.1559625
4 1100 C 0.12140127 0.03943988 0.2033627
5 1100 T 0.64560823 0.44898727 0.8422292
6 1100 U 0.06725172 0.01584248 0.1186610
d <- structure(list(Time = c(1000L, 1000L, 1000L, 1100L, 1100L, 1100L), Object = structure(c(1L, 2L, 3L, 1L, 2L, 3L), .Label = c("C",
"T", "U"), class = "factor"), y = c(0.12453389, 0.58826856, 0.0943716,
0.12140127, 0.64560823, 0.06725172), lower = c(0.04510504, 0.37615078,
0.03278069, 0.03943988, 0.44898727, 0.01584248), upper = c(0.2039627,
0.8003864, 0.1559625, 0.2033627, 0.8422292, 0.118661)), .Names = c("Time",
"Object", "y", "lower", "upper"), class = "data.frame", row.names = c("1",
"2", "3", "4", "5", "6"))
这是新的绘图代码:
ggplot(d, aes(Time, y, color = Object, fill = Object)) +
geom_line(size = 2) +
geom_ribbon(aes(ymin = lower, ymax = upper), alpha = .3)
推荐答案
您可以使用colour
参数删除边框:
You can remove the border using the colour
argument:
ggplot(d, aes(Time, y, color = Object, fill = Object)) +
geom_line(size = 2) +
geom_ribbon(aes(ymin = lower, ymax = upper), alpha = .3, colour = NA)
这篇关于ggplot:删除功能区边缘上的线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文