我正在学习R,并使用以下代码创建了基本的ggplot()
:
ggplot(aes(ACTIVITY_X, ACTIVITY_Y, color = as.factor(cluster), shape = Event)) + geom_point(size=3) + xlab("Axis X") + ylab("Axis Y") + labs(color="Cluster") + labs(shape="Dominant behaviour")
p + theme_classic()
我想编辑Cluster
下面的标签,以使它们成为"Standing"
,"Feeding"
和"Foraging"
。
如何从因子调用中编辑标签?我之前尝试过这种方法,但是没有运气:
+ ggplot(aes(ACTIVITY_X, ACTIVITY_Y, color = as.factor(cluster,
+ labels = "Standing",
+ "Feeding", "Foraging"))
+ , shape = Event) +
+ geom_point(size=3) + xlab("Axis X") + ylab("Axis Y") + labs(color="Cluster") + labs(shape="Dominant behaviour")
>
>
>
> p + theme_classic()
Error in as.factor(cluster, labels = "Standing", "Feeding", "Foraging") :
unused arguments (labels = "Standing", "Feeding", "Foraging")
此外,我想增加图中所有文本的大小,包括轴标签和图例。
感谢任何输入!