这是我目前所拥有的:
heat=read.csv("heat.csv")
head(heat)
heat$trap <- as.character(heat$trap)
class(heat$trap)
levels(heat$trap) <- c("T1", "T2", "T3", "T4","T5", "T6", "T7", "T8", "T9", "T10")
saeat <- ggplot(data = heat, mapping = aes(x = trip, y = trap, fill = sand)) + geom_tile() + ylab(label = "Trap") + xlab(label = "Month") + scale_fill_gradient(name = "Proportion of eggs", low = "#000033", high = "#FFFF33")
saeat
sand.heat <- veat + theme(strip.placement = "outside",plot.title = element_text(hjust = 0.5), axis.title.y = element_blank(), strip.background = element_rect(fill = "#EEEEEE", color = "#FFFFFF")) + ggtitle(label = "Sand treatment") + scale_y_discrete(breaks=c("T1", "T2", "T3", "T4","T5", "T6", "T7", "T8", "T9", "T10"))
swallows.heat
我找不到以这种方式订购y轴的方法:T1至T10。但是T10在T1之后就结束了。关于如何更改此设置的任何建议?
I'm not sure if works with a
character
variable in the same way, but if you use afactor
variable you can reorder the levels in the way you want it.