4-16일 Assignment

# drawp( )  #함수 생성
# barplot은 행렬이어야만 가능( matrix )
# 자료형을 변경 --> as.matrix( )

peach <-c(10,5,20,5,20,30,20)
banana <-c(5,10,20,15,10,20,5)
orange <-c(10,5,30,35,10,30,10)

fruit <- data.frame( peach, banana, orange)

#  barplot 저작
#  barplot(행렬, 그 외 옵션, . . . . . . )
barplot( as.matrix(fruit), beside = T,
         col=rainbow(nrow(fruit)))

#모든 차트에 레이블을 추가하실때는 legend( ) 함수사용
# legend(위치 - top, bottom, left, right, 크기는 cex)
legend("topleft", 
       legend=c("월", "화", "수", "목", "금", "토", "일"),
       cex=0.8, fill=rainbow(nrow(fruit)))