1
在以下示例中,ggplot
繪製了圖例,儘管命令爲guides(fill=FALSE)
。而且,它完全忽略了guides
。例如,您不能將圖例排列在列中。爲什麼ggplot會忽略R中的引導命令?
爲什麼會發生這種情況,以及如何在這種情況下控制圖例?
dfg = data.frame(category=sample(c("A", "B"), 10, replace=T),
name=sample(c("x", "y"), 10, replace=T),
clients=rnorm(10),
rating=rnorm(10))
ggplot(dfg, aes(x = clients, y = rating, color=category, label=name)) +
geom_text(hjust=0.5, vjust=0.5) +
guides(fill=FALSE)
你的情節裏沒有'fill'指南。你想要'指南(顏色= FALSE)'? – Roland
或'geom_text(hjust = 0.5,vjust = 0.5,show_guide = FALSE)' –
@Roland是的,其實我想要'指南(color = guide_legend(ncol = 2,bycol = T))',你的回答顯示瞭如何做到這一點。如果您在答案中發佈答案,我會很樂意接受您的答案。 –