利用ggplot2画图,有时候需要把x/y 轴按照数值由大到小反向显示,用 xlim() 、ylim() 就行了,示例如下:
library(ggplot2)
ggplot() +
geom_point(data = mtcars,aes(x = mpg, y = disp, color = qsec)) +
scale_colour_gradient2(low = "blue", mid = "green", high = "red", midpoint = 18) +
xlim(35, 10) +
ylim(500, 50) # 大小顺序调整一下即可