Skip to content

Long time listener, first time caller

10 messages · David Kennedy, steven mosher, dman +6 more

#
Hello there,

I'm using "raster" to great effect in a little something I'm building, but having a time trying to figure out this current issue. My intent is to build a "distance raster" from a center point out to 1km with cell size of 30x30. I had a few runs yesterday where this worked, but today with a different set of coordinates and UTM zone, I have a surfeit of "NA's" and white lines in my plotted raster.  Any notion as to what is causing the error?

I thank you in advance for your time and efforts.

________________________________________
David Kennedy
dkennedy at airsci.com | www.airsci.com


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dist_1km_code.txt
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20110714/f52c477e/attachment.txt>
-------------- next part --------------
#
@SM - I am in fact using 2.13.1 and will look into the image() call. The code
should be attached, here it is again 
http://r-sig-geo.2731867.n2.nabble.com/file/n6585138/dist_1km_code.jpg  

--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Long-time-listener-first-time-caller-tp6585078p6585138.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
#
looks fine. 

When plotting a Raster* object, raster calls the 'image' function. spplot
uses 'levelplot'. Both are affected by these white lines in R 2.13.1 on
Windows, I think (anyone seeing this on Mac or Linux? or not seeing this on
Windows?). Here is a simple test:

image(t(volcano)[ncol(volcano):1,])

In some cases there are only lines such that it seems that there are no data
values. I would expect that this will be fixed soon, but I am changing
'raster' so that the next version calls 'rasterImage' (which is not affected
and should be more efficient) in stead of 'image'.

Please correct me if I am wrong, but I think that for now one should not use
R 2.13.1 on Windows (and perhaps other OSs) if you want to plot raster data. 
Robert
R version 2.13.1 (2011-07-08)
Platform: i386-pc-mingw32/i386 (32-bit)


--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/Long-time-listener-first-time-caller-tp6585078p6585499.html
Sent from the R-sig-geo mailing list archive at Nabble.com.
#
I see the same on Windows 7 64-bit, with 32-bit R and 64bit R.

There's no need for the transpose/flip btw:

image(volcano)

but raster graphics don't product it, so it's the underlying image C
code (which is rect under the hood)

image(volcano, useRaster = TRUE)

plot(0, xlim = c(0, 1), ylim = c(0, 1))

rasterImage((volcano - min(volcano, na.rm = TRUE)) /
diff(range(volcano, na.rm = TRUE)), 0, 0, 1, 1, interpolate = FALSE)

plot(0, xlim = c(0, 1), ylim = c(0, 1))

rasterImage((volcano - min(volcano, na.rm = TRUE)) /
diff(range(volcano, na.rm = TRUE)), 0, 0, 1, 1)

I'd like to investigate more, but will have to wait for now.

Cheers, Mike.
On Fri, Jul 15, 2011 at 10:40 AM, Robert Hijmans <r.hijmans at gmail.com> wrote:

  
    
#
Hi Robert,

On my Mac the plot displays fine with no lines.

R version 2.13.1 (2011-07-08)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
[13] raster_1.8-39      sp_0.9-83

Cheers, Lyndon
On Thu, Jul 14, 2011 at 8:54 PM, Michael Sumner <mdsumner at gmail.com> wrote:

  
    
#
Dear Robert,

Working with:

 > sessionInfo()
R version 2.13.1 (2011-07-08)
Platform: i386-pc-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
[5] LC_TIME=French_France.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] raster_1.8-42  sp_0.9-84      fortunes_1.4-2

loaded via a namespace (and not attached):
[1] grid_2.13.1     lattice_0.19-30 tools_2.13.1


The issue is not specific to the GUI. I also see it with Rterm. I'm 
seeing the white lines on the windows() device (screen), as well as on 
jpeg, png, and postscript devices (though much finer lines for the 
latter). Conversely, pdf outputs don't seen to have the problem (also 
tested with other raster images).

All the best,

Renaud




Le 15/07/2011 02:40, Robert Hijmans a ?crit :

  
    
#
Dear Robert
i have tested using our example and it seems to work fine on mac

Best
On 15 Jul 2011, at 09:51, lancelot wrote: