[R] raster plot is empty

Henrik Bengtsson hb at biostat.ucsf.edu
Thu Sep 22 03:09:50 CEST 2011


Adding $0.01 to this: Maybe comparing outputs of capabilities() gives
some clues.

/Henrik


On Wed, Sep 21, 2011 at 6:00 PM, Alex Olssen <alex.olssen at gmail.com> wrote:
> Yes, Mike you are correct.
>
> In fact I did use
>
> plot(r)
>
> The code is exactly the same in both cases - the axis labels have the
> same numbers, same with the legend - there is just no picture.
>
> sessionInfo() for my desktop - where the code works
>
> R version 2.13.1 (2011-07-08)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_New Zealand.1252  LC_CTYPE=English_New Zealand.1252
> [3] LC_MONETARY=English_New Zealand.1252 LC_NUMERIC=C
> [5] LC_TIME=English_New Zealand.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] raster_1.9-13 sp_0.9-88
>
> loaded via a namespace (and not attached):
> [1] grid_2.13.1     lattice_0.19-30
>
> sessionInfo() from the server
>
> R version 2.13.1 (2011-07-08)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_New Zealand.1252  LC_CTYPE=English_New Zealand.1252
> [3] LC_MONETARY=English_New Zealand.1252 LC_NUMERIC=C
> [5] LC_TIME=English_New Zealand.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] raster_1.9-13 sp_0.9-88
>
> loaded via a namespace (and not attached):
> [1] grid_2.13.1     lattice_0.19-30
>
> And I can't see any difference!
>
> Kind regards,
> Alex
>
> On 22 September 2011 11:17, Michael Sumner <mdsumner at gmail.com> wrote:
>> Please ensure that it is really the exact same code, I'm sure you did
>> not mean to plot "f", but "r" (for example).
>>
>> Also, sessionInfo results are helpful always - see the posting guide
>> for ways to post better questions.
>>
>>> library(raster)
>> Loading required package: sp
>> raster version 1.9-5 (28-July-2011)
>>> f <- system.file("external/test.grd", package="raster")
>>> r <- raster(f)
>>
>> Here is "f" - not "r"!  And the error here is to be expected since f
>> is just a character string.
>>
>>> plot(f)
>> Error in plot.window(...) : need finite 'ylim' values
>> In addition: Warning messages:
>> 1: In xy.coords(x, y, xlabel, ylabel, log) : NAs introduced by coercion
>> 2: In min(x) : no non-missing arguments to min; returning Inf
>> 3: In max(x) : no non-missing arguments to max; returning -Inf
>>
>> Cheers, Mike.
>>
>>
>> On Thu, Sep 22, 2011 at 8:31 AM, Alex Olssen <alex.olssen at gmail.com> wrote:
>>> Dear Sarah,
>>>
>>> I am not sure how to make a reproducible example.  The 3 lines of code
>>> are exactly what I type in either system.  The code can be reproduced,
>>> but the result is unlikely to be reproduced - for example on my
>>> desktop this all works fine.  Is there something more I can do to make
>>> this reproducible?
>>>
>>> Is it helpful if I post the results of
>>>
>>> sessionInfo()
>>>
>>> ?
>>>
>>> Kind regards,
>>> Alex
>>>
>>> On 22 September 2011 09:55, Sarah Goslee <sarah.goslee at gmail.com> wrote:
>>>> Alex,
>>>>
>>>> We definitely need the output of sessionInfo(), the version of raster,
>>>> and a reproducible example.
>>>>
>>>>
>>>> Without knowing the versions & OS, it's impossible to say. But my
>>>> first guess (and
>>>> it IS a guess) is that the server needs to be updated.
>>>>
>>>> Sarah
>>>>
>>>>
>>>> On Wed, Sep 21, 2011 at 5:45 PM, Alex Olssen <alex.olssen at gmail.com> wrote:
>>>>> Dear R-help,
>>>>>
>>>>> I have a problem plotting maps using the raster package when I use R
>>>>> on my workplace server, but not when I use my own desktop.  I suspect
>>>>> the server version must be missing something and was wondering if
>>>>> anyone would have any ideas.
>>>>>
>>>>> The problem occurs after
>>>>>
>>>>> library(raster)
>>>>> f <- system.file("external/test.grd", package="raster")
>>>>> r <- raster(f)
>>>>> plot(f)
>>>>>
>>>>> On my desktop computer this works perfectly.  If I run this on my
>>>>> workplace server then the axes labels are identical, the legend
>>>>> numbers are identical, but the plot is empty and the legend has no
>>>>> colors in it.  This persists even if I specify a color explicitly
>>>>>
>>>>> plot(f, col="red")
>>>>>
>>>>> for example.
>>>>>
>>>>> Any help would be appreciated.
>>>>>
>>>>> Kind regards,
>>>>> Alex
>>>>>
>>>>
>>>> --
>>>> Sarah Goslee
>>>> http://www.functionaldiversity.org
>>>>
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list
>>> 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.
>>>
>>
>>
>>
>> --
>> Michael Sumner
>> Institute for Marine and Antarctic Studies, University of Tasmania
>> Hobart, Australia
>> e-mail: mdsumner at gmail.com
>>
>
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>



More information about the R-help mailing list