Skip to content
Prev 6823 / 12125 Next

[R-pkg-devel] Problem with S4 method for plotting a raster file

The inclusion of 'library(rgdal)' above suggests that your plot method needs something from 'rgdal'. If that something is a plot method from that package, it may not be visible from your function (due to changes introduced in R-4.0.0, search NEWS for R-4.0.0 'plot'), you would need to import plot methods from rgdal if that is the case (and maybe move rgdal from Suggests to Imports). 

Georgi Boshnakov


-----Original Message-----
From: R-package-devel <r-package-devel-bounces at r-project.org> On Behalf Of Duncan Murdoch
Sent: 14 April 2021 13:45
To: Jacob Nabe-Nielsen <jnn at bios.au.dk>; r-package-devel at r-project.org
Subject: Re: [R-pkg-devel] Problem with S4 method for plotting a raster file
On 14/04/2021 5:41 a.m., Jacob Nabe-Nielsen wrote:
I'm not sure exactly what is going wrong, but if you plot the coastline first and the bathymetry second, things do show up.  Maybe that's enough of a hint for you:

library(DEPONS2R)
data("coastline")
library(rgdal)
coastline2 <- spTransform(coastline, crs(bathymetry)) plot(coastline2, col="lightyellow2")

data("bathymetry")
plot(bathymetry, add=TRUE)

This puts the legend on top of the plotted coastline data, so my guess is that the limits of the bathymetry plot aren't being made available to the coastline plot when you do things in the original order.

Duncan Murdoch

______________________________________________
R-package-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel