본문 바로가기
R

(R) two lines in a graph, lines and points in a graph.

by jangpiano 2020. 8. 10.
반응형

<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")

반응형