我有以下的 ggplot
代码:
ggplot(Wheat_by_yearContinent, aes(x = Year, y = avgWheatYield, color = ContinentName)) +
theme(legend.position = "none") +
geom_line(size = 1) +
expand_limits(y = 0) +
ggtitle("Wheat") +
ylab(bquote('Average Yield ( '*'ton'~ ha^-1*')'))
我尝试了几种方法来抑制图例,但似乎无法弄清楚,也没有任何作用。有人遇到过这个问题/知道如何解决吗?在上面的代码中,我包含了+ theme(legend.position = "none")
,因为这是我的最后一次尝试,我还尝试了legend = FALSE
,但那里也没有任何东西。
mtcars
(ggplot(mtcars, aes(x = mpg, y = hp, col = cyl)) + geom_point() + theme(legend.position = "none")
),是否有相同的问题?您正在使用哪个版本的R
?您的软件包是否已更新?仅凭提供的信息很难帮助您解决问题。 - Oliver