R语言 ggplot 2-将图上的点更改为白色,并更改为正方形、圆形、闭合正方形和闭合圆形

jc3wubiy  于 2022-12-20  发布在  其他
关注(0)|答案(1)|浏览(176)

数据如下

我似乎找不到以下问题的答案,但我有一个ggplot2,我想把图上的点改为白色和正方形、圆形、闭合正方形和闭合圆形。
代码如下所示:

library(ggplot2)
Horticulture$Species<-factor(Horticulture$Species)
Horticulture$Speciesf<-factor(paste("ID",Horticulture$Species,sep=" "))
ggplot(Horticulture,aes(x=Time,y=growth,col=Horitculture:Speciesf))+
  geom_point()+geom_errorbar(aes(ymin=growth-SE,ymax=growth+SE))+
  geom_line() + xlab("Time [days]")+
  theme_bw(legend.title=element_blank(),
           legend.position = c(0.85, 0.85))+
  ylab(expression(paste("Growth [",days,"per measurement")))```
68bkxrlz

68bkxrlz1#

这能给予你的需要吗

# Load the required packages
library(ggplot2)

# Create a sample data frame
Horticulture <- data.frame(
  species = rep(letters[1:4], 10),
  Time = rep(1:10,each = 4),
  growth = rnorm(40, 1.3, 0.4),
  SE = rnorm(40,0.1,0.1))

# generate plot
ggplot(Horticulture,aes(x=Time, y=growth, shape=species))+
  geom_point() + geom_errorbar(aes(ymin=growth-SE,ymax=growth+SE))+
  geom_line() + xlab("Time [days]")+
  ylab(expression(paste("Growth [",days,"per measurement"))) +
  scale_shape_manual(values = c(0,1,15,16))

相关问题