2019-03-12
阅读量:
1190
R中ggplot2 线图
df <- data.frame(dose=c("D0.5", "D1", "D2"),
len=c(4.2, 10, 29.5))
head(df)
## dose len
## 1 D0.5 4.2
## 2 D1 10.0
## 3 D2 29.5
len : 牙齿长度
dose : 以毫克为单位的药物剂量 (0.5, 1, 2)
创建带点的线图
library(ggplot2)
# 带点的基本线图
ggplot(data=df, aes(x=dose, y=len, group=1)) +
geom_line()+
geom_point()
# 改变线型
ggplot(data=df, aes(x=dose, y=len, group=1)) +
geom_line(linetype = "dashed")+
geom_point()
# 改变颜色
ggplot(data=df, aes(x=dose, y=len, group=1)) +
geom_line(color="red")+
geom_point()






评论(0)


暂无数据
推荐帖子
0条评论
0条评论
0条评论