RasterLayer rescaling issue after rescaling plotting device window.
Closed this issue · 1 comments
When the size of the plotting device window is changed after plotting (Plot()
), the axes' scales and the SpatialPoints layers are rescaled according to the new ratio of the plotting device window, but the RasterLayer's aspect ratio does not. These plots keep their fixed 1:1 ratio. Therefore, the combined plots turn out wrong after rescaling the plotting device window (axes and species distribution points do not correspond with the gridpoints in the environment plots). Since users are guided by these non-rescaled RasterLayer to locate their desired points for clilck-values and click-extends this also results in wrong outputs for the clickValue()
and clickExtend()
functions, which use the correct rescaled coordinates within the plotting device window to extract their values.
This won't be a problem if users do not change their plotting device window size, but my experience is that I change it regularly while working on a project.
This is a "feature" of the grid package, which is the underlying plotting engine. The grid.axis function does not rescale the same way as the grid.raster function. The work around we have implemented is to run rePlot()
which should rescale everything correctly. There is a different issue with that, however, that the axes, if they were plotted, do not replot :(