【发布时间】:2012-03-21 10:42:55
【问题描述】:
我正在创建以光栅文件为背景的地理地图。为了更好地显示,我想将其中一些向侧面翻转(即,使北指向左侧,而不是向上)。这意味着我必须反转 x 轴(除了翻转 x 和 y),否则数据显示错误(镜像)。
它适用于 geom_tile,但当然这很慢,尤其是在做构面时。 所以,我想使用annotation_raster。这也很好,但只有在我反转 x 轴之前。然后就不再显示了。
此外,我怀疑这可能是相关的:切换 xmin 和 xmax 值似乎没有任何效果。始终以 xmin=min(xmin,xmax) 和 xmax=max(xmin,xmax) 显示。
library(ggplot2) ## v0.9.0
## works
qplot(mpg, wt, data = mtcars) + annotation_raster(rainbow, xmin=15, xmax=20, ymin=3, ymax=4)
## swiching xmin and xmax, doesn't affect plotting
qplot(mpg, wt, data = mtcars) + annotation_raster(rainbow, xmin=20, xmax=15, ymin=3, ymax=4)
## doesn't work
qplot(mpg, wt, data = mtcars) + annotation_raster(rainbow, xmin=15, xmax=20, ymin=3, ymax=4) + scale_x_reverse()
我会很感激任何想法。
干杯
【问题讨论】: