ggplot中點的樣式展示:
library(ggplot2)# 創建數據框
a<- data.frame(x = 0:25, y = 0:25)
# 創建散點圖
ggplot(a, aes(x = x, y = y, shape = as.factor(y))) +geom_point(size = 4) +scale_shape_manual(values = 0:25) +labs(shape = "形狀") +theme(legend.direction = "vertical",legend.position = "bottom",legend.key = element_rect(colour = "white", fill = "white"))
示例圖如下: