[R] Using map with filled.contour doesn't display map
David Winsemius
dwinsemius at comcast.net
Sat Nov 5 01:43:24 CET 2016
> On Nov 4, 2016, at 11:26 AM, Jeff Charlton <jcharlto16 at gmail.com> wrote:
>
> Hello,
>
> I'm trying to overlay a map on top of data showing temperatures across the
> world. The code I'm using is:
>
> filledContour(tempdata, plot.axes={axis(1); axis(2); map("world2",
> add=TRUE)})
>
> where tempdata is a raster file made from a netcdf file downloaded from the
> NOAA website. The filledContour is a wrapper that translates the raster
> image into something that can be used by filled.contour.
>
> If I run the code:
>
> filledContour(tempdata)
It's somewhat difficult to advise since in one place you say you are using filled.contour, but above you are writing filledContour (but are not saying where this function comes from or offering the required `library` call to set this up.). You are also not offering any data example. Suggest you make this a complete example.
>
> I get the image I want, but when I add the plot.axes parameter, I get a
> "plot.new has not been called yet" error in axis(1). If I run plot.new()
> and the original filledContour call, I get the same result as if I just did
> filledContour(tempdata) (i.e. no map is overlayed).
>
> The kicker in all this is that this code worked a couple of years ago. I
> ran into this error when I recently dusted of my code and installed the
> latest version of R and its various packages. I have a feeling that
> something has changed in the maps package but I can't find any reference to
> it online.
>
> Can anyone help?
>
> Thank you,
>
> Jeff
>
> Just in case, here's my session info:
>
> R version 3.3.2 (2016-10-31) Platform: x86_64-w64-mingw32/x64 (64-bit)
> Running under: Windows 7 x64 (build 7601) Service Pack 1
>
> locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
> States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C
> LC_TIME=English_United States.1252
>
> attached base packages: [1] stats graphics grDevices utils datasets methods
> base
>
> other attached packages: [1] ncdf4_1.15 maps_3.1.1 XML_3.98-1.4
> RCurl_1.95-4.8 bitops_1.0-6 raster_2.5-8 sp_1.2-3
>
> loaded via a namespace (and not attached): [1] parallel_3.3.2 tools_3.3.2
> Rcpp_0.12.7 grid_3.3.2 lattice_0.20-34
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list