>RE::VISION CRM

R 데이터 분석

자신만의 컬러챠트 생성 예제

YONG_X 2015. 8. 5. 11:34






# YONG's own color chart


coldf <- data.frame(colnum = c(12, 23, 30, 36, 40, 41, 51, 56, 67, 71, 72, 73, 74, 79, 93, 100))

coldf$colname <- colors()[coldf$colnum]

colrgbdf<- as.data.frame(t(col2rgb(coldf$colname)))

coldf <- cbind(coldf, colrgbdf)


# par_back <- par()

# to make enough space to show color names

par(mar=c(7,4,3,2))


plot(coldf$colnum, pch=15, col=rgb(coldf$red,coldf$green,coldf$blue, maxColorValue=255), cex=3, main="my own color chart", xlab="", xaxt='n')

axis(1, at=c(1:nrow(coldf)), labels=coldf$colname, tck=-0.01, las=2)

text(coldf$colnum, labels=coldf$colnum, pos=2)


# get back to the default margin specification

par(par_back)