10
데이터 세트의 다른 변수에 따라 히트 맵 축 텍스트의 색을 변경하고 싶습니다. 변수로 색 축 텍스트
#load data, scale numeric columns, add state abbreviation and region
state_data <- data.frame(state.x77)
state_data <- state_data[,1:8]
state_data <- rescaler(state_data, type='range')
state_data$State <- state.abb
state_data$Region <- state.region
#make heatmap
melted_state <- melt(state_data,id.vars=c('State', 'Region'))
p <- ggplot(melted_state,
aes(x=State, y=variable))
p <- p + geom_tile(aes(fill = value), colour = "white")
p <- p + theme(axis.text.x=element_text(colour="Region")) ## doesn't work!
p
내가이 오류를 얻을 : 이것은 내가 지금까지 시도한 것입니다 grid.Call (L_textBounds에서 오류, as.graphicsAnnot (X의 $ 라벨)의 X $의 X, X의 $ y를, : 잘못된 색 이름 '지역'
내가 '지역'주위에 따옴표를 제거하면이 오류 얻을 : 나는이 작업을 수행 할 수있는 방법
Error in structure(list(family = family, face = face, colour = colour, : object 'Region' not found
재미있는, 그러나 나는 이것이'ggplot2' 저자 (들)에 의해 고려되지 유연성의 축 생각, 그래서 어려울 수 있습니다 해야 할 것. –