반응형
<Three ways to make a line graph>
> plot(women$height,women$weight,type="l")
> ggplot(data=women,aes(x=height,y=weight))+geom_line()
> qplot(data=women,height,weight,geom="line")
<Three ways to make a point graph on the line graph>
> plot(women$height,women$weight,type="l")
> points(women$height,women$weight)
> ggplot(data=women,aes(x=height,y=weight))+geom_line()+geom_point()
> qplot(data=women,height,weight,geom=c("line","point"))
<Two lines in a graph - Ibs to kg>
> ggplot(data=women,aes(x=height,y=weight))+geom_line()+geom_point()+geom_line(aes(x=height,y=weight/2.205),col="red")
>ggplot(data=women,aes(x=height,y=weight))+geom_line()+geom_point()+geom_line(aes(x=height,y=weight/2.205),col="red")+geom_point(aes(x=height,y=weight/2.205),col="red")
반응형
'R' 카테고리의 다른 글
Ways to draw histogram, adjust the width of boxes/ hist(),ggplot(),qplot() (0) | 2020.08.11 |
---|---|
(R) Ways to make Bar graph (continuous variable --> Discrete variable)/qplot, ggplot,barplot (0) | 2020.08.11 |
(R) list colors of columns in order / character type to factor type (0) | 2020.07.30 |
(R) Reorder columns in any orders / scale_x_discrete() (0) | 2020.07.30 |
(R) coord_flip() (0) | 2020.07.30 |