본문 바로가기

빅데이터과정/R

#49_140822_R_LINE CHART

728x90

# LINE CHART




 

 

Line Chart




 

> cars <- c(1,2,6,4,9)

> plot(cars,type="o",col="blue",main="test")

 



 

> trucks <- c(2,5,4,5,12)

> lines(trucks,type="o",pch=20,lty=2,col="red")

 




 

> plot(sal,comm)

 

 

 

 

> a <- at[at$Name=='박솔훈',c(2:41)]

> a <- as.integer(a)

> a

[1] 8 8 8 8 0 0 0 8 7 8 8 8 7 8 8 8 8 8 7 7 7 8 8 8 8 8 8 8 8 8 8 0 8 8 8 8 8 8 0 8

> plot(a,type="o",col="blue",ann=F)

 

 



> a <- as.integer(at[at$Name=='이우람',c(2:41)])

> a

 [1] 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8

> lines(a,type="o",lty=2,col="red")

 

 

 

 

 

> install.packages("ggmap")

> library(ggmap)

> library(ggplot2)

 

서울지하철3호선역위경도정보.csv


 

> loc <- read.csv("서울지하철3호선역위경도정보.csv",header=T)

 

> kor <- get_map("seongbuk gu", zoom=11, maptype = "roadmap")

구글맵의 함수를 불러온다

> kor.map <- ggmap(kor)+geom_point(data=loc, aes(x=LON, y=LAT),size=3,alpha=0.7,col="red")

> kor.map

 




> kor.map + geom_path(data=loc,aes(x=LON,y=LAT),size=1,linetype=2,col="green")+

geom_text(data=loc, aes(x = LON, y = LAT+0.005, label=역명),size=2)

 




 

 

 

서울지하철2호선위경도정보.csv



> loc <- read.csv("서울지하철2호선위경도정보.csv",header=T)

> kor.map + geom_path(data=loc,aes(x=LON,y=LAT),size=1,linetype=2,col="green")+

geom_text(data=loc, aes(x = LON, y = LAT+0.005, label=역명),size=2)

 



 

 

 





그래프 겹쳐 그리기

 

plot(audio1)

attach(mtcars)

opar <- par(no.readonly = TRUE)

par(mfrow = c(2, 2))

plot(wt, mpg, main = "Scatterplot of wt vs. mpg")

plot(wt, disp, main = "Scatterplot of wt vs disp")

hist(wt, main = "Histogram of wt")

boxplot(wt, main = "Boxplot of wt")

par(opar)

detach(mtcars)

 



 

 

audio_a <- readWave("a.wav")

audio_b <- readWave("b.wav")

audio_c <- readWave("c.wav")

audio_d <- readWave("d.wav")

audio_e <- readWave("e.wav")

audio_f <- readWave("f.wav")

audio_g <- readWave("g.wav")

audio_h <- readWave("h.wav")

audio_nor <- readWave("normal.wav")



opar <- par(no.readonly = TRUE)

par(mfrow = c(3, 3))

plot(audio_a)

plot(audio_b)

plot(audio_c)

plot(audio_d)

plot(audio_e)

plot(audio_f)

plot(audio_g)

plot(audio_h)

plot(audio_nor )

par(opar)


 


9번째 그래프가 심장박동 그래프인데 가장 비슷한 것이 8번째 그래프이기 떄문에 8번도 심장박동 그래프라고 할 수 있다

 




'빅데이터과정 > R' 카테고리의 다른 글

#50_140825_R_움직이는 GRAPH  (0) 2014.08.25
#50_140825_R_AUDIO GRAPH  (0) 2014.08.25
#49_140822_R_BAR PLOT  (0) 2014.08.22
#48_140821_R_SUBQUERY  (0) 2014.08.21
#48_140821_R_COUNT  (0) 2014.08.21