[英]Can't get ggplot to produce a geom_line
I am kind of new to r so sorry if I don't make a lot of sense, but I have been plotting data fine with geom_line, but for some reason this line is not showing up.我是 r 的新手,很抱歉,如果我没有太多意义,但我一直在用 geom_line 绘制数据,但由于某种原因,这条线没有出现。 I am not getting any errors or anything though.
我没有收到任何错误或任何东西。 Code:
代码:
ggplot(data=ABB, aes(x=Label1, y=Average, color=factor(Native))) +
geom_line(size=.2) +
geom_point(size=.6) +
labs(
title = "Alton Baker Park Bloom Rates",
y = "Week First Seen",
x = "Year Seen"
) +
theme_simple +
theme(
legend.title = element_blank(),
plot.title = element_text(size=20),
axis.title = element_text(size=14),
axis.text = element_text(size=10),
axis.text.y = element_text(size=10),
axis.line = element_line(size=.5)
)
Heres what I'm getting这是我得到的
There is a lot of data but here is some of it.有很多数据,但这里只是其中的一部分。
Assuming your data looks something like this, I'm not sure why it's not working for you...can you share your data?假设您的数据看起来像这样,我不确定为什么它对您不起作用……您可以分享您的数据吗?
df <-
data.frame(
year = c(1990:2010, 1990:2010),
value = c(runif(21, 0, 5), runif(21, 4, 10)),
species = c(rep('Invasive', 21), rep('Native', 21))
)
ggplot(data=df, aes(x=year, y=value, color=factor(species))) +
geom_line(size=.2) +
geom_point(size=.6)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.