Veri kümesindeki başka bir değişkene bağlı olarak, heatmap eksen metnimin rengini değiştirmek istiyorum. Renk ekseni metnine göre değişken
#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
bu hatayı alıyorum: Bu şimdiye kadar denedim budur grid.Call (L_textBounds içinde hatası, as.graphicsAnnot (x $ etiket), x $ x x $ y: geçersiz renk adı 'Bölge'
Ve 'Bölgesinde' sonuna tırnak işareti kaldırırsanız bu hatayı alıyorum: bunu nasıl
Error in structure(list(family = family, face = face, colour = colour, : object 'Region' not found
ilginç, ama bu 'ggplot2' yazar (lar) tarafından kabul edilmez bir esneklik ekseni olduğunu düşünüyorum, bu yüzden zor olabilir yap. –