plotting rasters - no plot, no error

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

plotting rasters - no plot, no error

Monica Pisica

Hi,

 

I have the current version of R installed on 2 different Windows computers. On one i can plot using the plot function a raster in geotif format, on the other it plots only the axis, an empty color bar and no raster what so ever without generating any errors or warnings. So i suspect something is not installed properly, but i don't know what. Do you have any clues? I would really appreciate any insights. I need some instructions i can pass on to an IT person since i don't have rights on the computer that does not plot the raster.

 

On both computers i can plot lines, points, polygons, as graphic objects or shapefiles.

 

Thanks so much, Monica

 

The first PC that plots the raster:

Sys.info()

                     sysname                      release                      version

                   "Windows"                      "7 x64" "build 7601, Service Pack 1"

                    nodename                      machine                        login

            "NODENAME"                     "x86-64"                       "LOGIN"

                        user               effective_user

                      "MONICA"                       "MONICA"

 

R.Version()

$platform

[1] "x86_64-w64-mingw32"

 

$arch

[1] "x86_64"

 

$os

[1] "mingw32"

 

$system

[1] "x86_64, mingw32"

 

$status

[1] ""

 

$major

[1] "3"

 

$minor

[1] "1.3"

 

$year

[1] "2015"

 

$month

[1] "03"

 

$day

[1] "09"

 

$`svn rev`

[1] "67962"

 

$language

[1] "R"

 

$version.string

[1] "R version 3.1.3 (2015-03-09)"

 

$nickname

[1] "Smooth Sidewalk"

 

Libraries i loaded: maptools, raster, rgdal, sp, CircStats, rgeos, stringr

 

The computer that does not plot the raster:

Sys.info()

                     sysname                      release                      version                     nodename

                   "Windows"            "Server 2008 x64" "build 7601, Service Pack 1"              "NODENAME"

                     machine                        login                         user               effective_user

                    "x86-64"                       "MONICA"                       "MONICA"                       "MONICA"

 

R.Version()

$platform

[1] "x86_64-w64-mingw32"

 

$arch

[1] "x86_64"

 

$os

[1] "mingw32"

 

$system

[1] "x86_64, mingw32"

 

$status

[1] ""

 

$major

[1] "3"

 

$minor

[1] "1.3"

 

$year

[1] "2015"

 

$month

[1] "03"

 

$day

[1] "09"

 

$`svn rev`

[1] "67962"

 

$language

[1] "R"

 

$version.string

[1] "R version 3.1.3 (2015-03-09)"

 

$nickname

[1] "Smooth Sidewalk"

 

Libraries i loaded: maptools, raster, rgdal, sp, CircStats, rgeos, stringr



again thanks so much,

Monica

     
______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: plotting rasters - no plot, no error

Michael Sumner-2
On Wed, 15 Apr 2015 at 00:50 Monica Pisica <[hidden email]> wrote:

>
> Hi,
>
>
>
> I have the current version of R installed on 2 different Windows
> computers. On one i can plot using the plot function a raster in geotif
> format, on the other it plots only the axis, an empty color bar and no
> raster what so ever without generating any errors or warnings. So i suspect
> something is not installed properly, but i don't know what. Do you have any
> clues? I would really appreciate any insights. I need some instructions i
> can pass on to an IT person since i don't have rights on the computer that
> does not plot the raster.
>
>
>
Hello, can you try these on both systems and see if there's a difference?

 library(raster)
plot(raster(volcano))

plot(raster(volcano), useRaster = TRUE)

the useRaster argument refers to use of graphics::rasterImage rather than
image.defaul under (package) raster's hood.

Cheers, Mike.


> On both computers i can plot lines, points, polygons, as graphic objects
> or shapefiles.
>
>
>
> Thanks so much, Monica
>
>
>
> The first PC that plots the raster:
>
> Sys.info()
>
>                      sysname                      release
>     version
>
>                    "Windows"                      "7 x64" "build 7601,
> Service Pack 1"
>
>                     nodename                      machine
>       login
>
>             "NODENAME"                     "x86-64"
>  "LOGIN"
>
>                         user               effective_user
>
>                       "MONICA"                       "MONICA"
>
>
>
> R.Version()
>
> $platform
>
> [1] "x86_64-w64-mingw32"
>
>
>
> $arch
>
> [1] "x86_64"
>
>
>
> $os
>
> [1] "mingw32"
>
>
>
> $system
>
> [1] "x86_64, mingw32"
>
>
>
> $status
>
> [1] ""
>
>
>
> $major
>
> [1] "3"
>
>
>
> $minor
>
> [1] "1.3"
>
>
>
> $year
>
> [1] "2015"
>
>
>
> $month
>
> [1] "03"
>
>
>
> $day
>
> [1] "09"
>
>
>
> $`svn rev`
>
> [1] "67962"
>
>
>
> $language
>
> [1] "R"
>
>
>
> $version.string
>
> [1] "R version 3.1.3 (2015-03-09)"
>
>
>
> $nickname
>
> [1] "Smooth Sidewalk"
>
>
>
> Libraries i loaded: maptools, raster, rgdal, sp, CircStats, rgeos, stringr
>
>
>
> The computer that does not plot the raster:
>
> Sys.info()
>
>                      sysname                      release
>     version                     nodename
>
>                    "Windows"            "Server 2008 x64" "build 7601,
> Service Pack 1"              "NODENAME"
>
>                      machine                        login
>        user               effective_user
>
>                     "x86-64"                       "MONICA"
>        "MONICA"                       "MONICA"
>
>
>
> R.Version()
>
> $platform
>
> [1] "x86_64-w64-mingw32"
>
>
>
> $arch
>
> [1] "x86_64"
>
>
>
> $os
>
> [1] "mingw32"
>
>
>
> $system
>
> [1] "x86_64, mingw32"
>
>
>
> $status
>
> [1] ""
>
>
>
> $major
>
> [1] "3"
>
>
>
> $minor
>
> [1] "1.3"
>
>
>
> $year
>
> [1] "2015"
>
>
>
> $month
>
> [1] "03"
>
>
>
> $day
>
> [1] "09"
>
>
>
> $`svn rev`
>
> [1] "67962"
>
>
>
> $language
>
> [1] "R"
>
>
>
> $version.string
>
> [1] "R version 3.1.3 (2015-03-09)"
>
>
>
> $nickname
>
> [1] "Smooth Sidewalk"
>
>
>
> Libraries i loaded: maptools, raster, rgdal, sp, CircStats, rgeos, stringr
>
>
>
> again thanks so much,
>
> Monica
>
>
> ______________________________________________
> [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: plotting rasters - no plot, no error

Michael Sumner-2
On Wed, 15 Apr 2015 at 01:16 Michael Sumner <[hidden email]> wrote:

> On Wed, 15 Apr 2015 at 00:50 Monica Pisica <[hidden email]> wrote:
>
>>
>> Hi,
>>
>>
>>
>> I have the current version of R installed on 2 different Windows
>> computers. On one i can plot using the plot function a raster in geotif
>> format, on the other it plots only the axis, an empty color bar and no
>> raster what so ever without generating any errors or warnings. So i suspect
>> something is not installed properly, but i don't know what. Do you have any
>> clues? I would really appreciate any insights. I need some instructions i
>> can pass on to an IT person since i don't have rights on the computer that
>> does not plot the raster.
>>
>>
>>
> Hello, can you try these on both systems and see if there's a difference?
>
>  library(raster)
> plot(raster(volcano))
>
> plot(raster(volcano), useRaster = TRUE)
>
>

Ugh, sorry I meant to try this:

plot(raster(volcano), useRaster = FALSE)

  otherwise both calls are equivalent.

Cheers, Mike.


the useRaster argument refers to use of graphics::rasterImage rather than

> image.defaul under (package) raster's hood.
>
> Cheers, Mike.
>
>
>> On both computers i can plot lines, points, polygons, as graphic objects
>> or shapefiles.
>>
>>
>>
>> Thanks so much, Monica
>>
>>
>>
>> The first PC that plots the raster:
>>
>> Sys.info()
>>
>>                      sysname                      release
>>       version
>>
>>                    "Windows"                      "7 x64" "build 7601,
>> Service Pack 1"
>>
>>                     nodename                      machine
>>         login
>>
>>             "NODENAME"                     "x86-64"
>>  "LOGIN"
>>
>>                         user               effective_user
>>
>>                       "MONICA"                       "MONICA"
>>
>>
>>
>> R.Version()
>>
>> $platform
>>
>> [1] "x86_64-w64-mingw32"
>>
>>
>>
>> $arch
>>
>> [1] "x86_64"
>>
>>
>>
>> $os
>>
>> [1] "mingw32"
>>
>>
>>
>> $system
>>
>> [1] "x86_64, mingw32"
>>
>>
>>
>> $status
>>
>> [1] ""
>>
>>
>>
>> $major
>>
>> [1] "3"
>>
>>
>>
>> $minor
>>
>> [1] "1.3"
>>
>>
>>
>> $year
>>
>> [1] "2015"
>>
>>
>>
>> $month
>>
>> [1] "03"
>>
>>
>>
>> $day
>>
>> [1] "09"
>>
>>
>>
>> $`svn rev`
>>
>> [1] "67962"
>>
>>
>>
>> $language
>>
>> [1] "R"
>>
>>
>>
>> $version.string
>>
>> [1] "R version 3.1.3 (2015-03-09)"
>>
>>
>>
>> $nickname
>>
>> [1] "Smooth Sidewalk"
>>
>>
>>
>> Libraries i loaded: maptools, raster, rgdal, sp, CircStats, rgeos, stringr
>>
>>
>>
>> The computer that does not plot the raster:
>>
>> Sys.info()
>>
>>                      sysname                      release
>>       version                     nodename
>>
>>                    "Windows"            "Server 2008 x64" "build 7601,
>> Service Pack 1"              "NODENAME"
>>
>>                      machine                        login
>>          user               effective_user
>>
>>                     "x86-64"                       "MONICA"
>>          "MONICA"                       "MONICA"
>>
>>
>>
>> R.Version()
>>
>> $platform
>>
>> [1] "x86_64-w64-mingw32"
>>
>>
>>
>> $arch
>>
>> [1] "x86_64"
>>
>>
>>
>> $os
>>
>> [1] "mingw32"
>>
>>
>>
>> $system
>>
>> [1] "x86_64, mingw32"
>>
>>
>>
>> $status
>>
>> [1] ""
>>
>>
>>
>> $major
>>
>> [1] "3"
>>
>>
>>
>> $minor
>>
>> [1] "1.3"
>>
>>
>>
>> $year
>>
>> [1] "2015"
>>
>>
>>
>> $month
>>
>> [1] "03"
>>
>>
>>
>> $day
>>
>> [1] "09"
>>
>>
>>
>> $`svn rev`
>>
>> [1] "67962"
>>
>>
>>
>> $language
>>
>> [1] "R"
>>
>>
>>
>> $version.string
>>
>> [1] "R version 3.1.3 (2015-03-09)"
>>
>>
>>
>> $nickname
>>
>> [1] "Smooth Sidewalk"
>>
>>
>>
>> Libraries i loaded: maptools, raster, rgdal, sp, CircStats, rgeos, stringr
>>
>>
>>
>> again thanks so much,
>>
>> Monica
>>
>>
>> ______________________________________________
>> [hidden email] 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.
>>
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: plotting rasters - no plot, no error

Monica Pisica
Hi Mike,


Very interesting. The plot itself on the computer that does not plot - still does not plot - no surprise there. But the command with useRaster = FALSE actually plots the raster. So that means it is something wrong with the raster package? Did i forget to install some dependency, although i though i ask for all to be installed?


I still don't know how to solve the problem, but thanks so much for an alternative way to actually plot my rasters.


Monica
________________________________
> From: [hidden email]
> Date: Tue, 14 Apr 2015 15:18:01 +0000
> Subject: Re: [R] plotting rasters - no plot, no error
> To: [hidden email]; [hidden email]
>

> On Wed, 15 Apr 2015 at 01:16 Michael Sumner
> <[hidden email]<mailto:[hidden email]>> wrote:
> On Wed, 15 Apr 2015 at 00:50 Monica Pisica
> <[hidden email]<mailto:[hidden email]>> wrote:
>
> Hi,


> computers. On one i can plot using the plot function a raster in geotif
> format, on the other it plots only the axis, an empty color bar and no
> raster what so ever without generating any errors or warnings. So i
> suspect something is not installed properly, but i don't know what. Do
> you have any clues? I would really appreciate any insights. I need some
> instructions i can pass on to an IT person since i don't have rights on
> the computer that does not plot the raster.

> Hello, can you try these on both systems and see if there's a difference?
>
> library(raster)
> plot(raster(volcano))
>
> plot(raster(volcano), useRaster = TRUE)

> Ugh, sorry I meant to try this:
>
> plot(raster(volcano), useRaster = FALSE)
>
> otherwise both calls are equivalent.
>
> Cheers, Mike.
>

> the useRaster argument refers to use of graphics::rasterImage rather
> than image.defaul under (package) raster's hood.
>
> Cheers, Mike.

> On both computers i can plot lines, points, polygons, as graphic
> objects or shapefiles.

> Thanks so much, Monica

> The first PC that plots the raster:
>
> Sys.info()
>
> sysname release
> version
>

> Service Pack 1"
>
> nodename machine
> login
>
> "NODENAME" "x86-64"
> "LOGIN"
>
> user effective_user
>
> "MONICA" "MONICA"

> R.Version()
>
> $platform
>
> [1] "x86_64-w64-mingw32"

> $arch
>
> [1] "x86_64"

> $os
>
> [1] "mingw32"

> $system
>
> [1] "x86_64, mingw32"

> $status
>
> [1] ""

> $major
>
> [1] "3"

> $minor
>
> [1] "1.3"

> $year
>
> [1] "2015"

> $month
>
> [1] "03"

> $day
>
> [1] "09"

> $`svn rev`
>
> [1] "67962"

> $language
>
> [1] "R"

>
> $version.string
>
> [1] "R version 3.1.3 (2015-03-09)"

> $nickname
>
> [1] "Smooth Sidewalk"

> Libraries i loaded: maptools, raster, rgdal, sp, CircStats, rgeos, stringr

> The computer that does not plot the raster:
>
> Sys.info()
>
> sysname release
> version nodename
>

> Service Pack 1" "NODENAME"
>
> machine login
> user effective_user
>
> "x86-64" "MONICA"
> "MONICA" "MONICA"

> R.Version()
>
> $platform
>
> [1] "x86_64-w64-mingw32"

> $arch
>
> [1] "x86_64"

> $os
>
> [1] "mingw32"

> $system
>
> [1] "x86_64, mingw32"
>

> $status
>
> [1] ""
>

> $major
>
> [1] "3"

> $minor
>
> [1] "1.3"
>

> $year
>
> [1] "2015"

> $month
>
> [1] "03"
>

> $day
>
> [1] "09"

> $`svn rev`
>
> [1] "67962"
>

> $language
>
> [1] "R"

> $version.string
>
> [1] "R version 3.1.3 (2015-03-09)"

> $nickname
>
> [1] "Smooth Sidewalk"

> Libraries i loaded: maptools, raster, rgdal, sp, CircStats, rgeos, stringr

> again thanks so much,
>
> Monica

> ______________________________________________
> [hidden email]<mailto:[hidden email]> 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.      
______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: plotting rasters - no plot, no error

Michael Sumner-2
On Wed, 15 Apr 2015 at 02:49 Monica Pisica <[hidden email]> wrote:

> Hi Mike,
>
>
> Very interesting. The plot itself on the computer that does not plot -
> still does not plot - no surprise there. But the command with useRaster =
> FALSE actually plots the raster. So that means it is something wrong with
> the raster package? Did i forget to install some dependency, although i
> though i ask for all to be installed?
>
>
>
Is this through Windows Remote Desktop? There's a note in ?rasterImage:

" Problems with the rendering of raster images have been
     reported by users of ‘windows()’ devices under Remote Desktop, at
     least under its default settings.
"

and see here:

https://stat.ethz.ch/pipermail/r-help//2013-July/357287.html

Note that raster::plot has arguments for the underlying image functions
 graphics::image and graphics::rasterImage - these are "interpolate" and
"useRaster".  The terminology is confusing, partly because rasterImage()
and its underlying code was put in base R at around the same time as the
extension package "raster" appeared. (rasterImage was originally called
"raster" so it's less confusing than it might have been)

The details get hidden because of the high-level plot() and image()
functions (and raster's additional methods for those), but essentially for
tracking down the ultimate cause you should see if you can reproduce with
the following four lines (without raster loaded):

data(volcano)
vn <- (volcano - min(volcano)) / diff(range(volcano))

## for each 1-4, close any open graphics windows first
## just to be sure (use dev.off() for convenience)

# 1.  image.default
image(vn)

# 2. rasterImage via image.default
image(vn, useRaster = TRUE)

# 3. rasterImage with interpolation
plot(0, xlim = c(0, 1),ylim = c(0,1), type = "n")
rasterImage(vn, 0, 0, 1, 1)

# 4. rasterImage without interpolation
plot(0, xlim = c(0, 1),ylim = c(0,1), type = "n")
rasterImage(vn, 0, 0, 1, 1,  interpolate = FALSE)

If you can reproduce the problem with these four cases, you have a clearer
basis to work from. These are the components from with raster's plot
methods are built, and I don't think raster is to blame here.

There might be settings for colour you can control with Remote Desktop.

Cheers, Mike.

I still don't know how to solve the problem, but thanks so much for an

> alternative way to actually plot my rasters.
>
>
> Monica
> ________________________________
> > From: [hidden email]
> > Date: Tue, 14 Apr 2015 15:18:01 +0000
> > Subject: Re: [R] plotting rasters - no plot, no error
> > To: [hidden email]; [hidden email]
> >
>
> > On Wed, 15 Apr 2015 at 01:16 Michael Sumner
> > <[hidden email]<mailto:[hidden email]>> wrote:
> > On Wed, 15 Apr 2015 at 00:50 Monica Pisica
> > <[hidden email]<mailto:[hidden email]>> wrote:
> >
> > Hi,
>
> > I have the current version of R installed on 2 different Windows
> > computers. On one i can plot using the plot function a raster in geotif
> > format, on the other it plots only the axis, an empty color bar and no
> > raster what so ever without generating any errors or warnings. So i
> > suspect something is not installed properly, but i don't know what. Do
> > you have any clues? I would really appreciate any insights. I need some
> > instructions i can pass on to an IT person since i don't have rights on
> > the computer that does not plot the raster.
>
> > Hello, can you try these on both systems and see if there's a difference?
> >
> > library(raster)
> > plot(raster(volcano))
> >
> > plot(raster(volcano), useRaster = TRUE)
>
> > Ugh, sorry I meant to try this:
> >
> > plot(raster(volcano), useRaster = FALSE)
> >
> > otherwise both calls are equivalent.
> >
> > Cheers, Mike.
> >
>
> > the useRaster argument refers to use of graphics::rasterImage rather
> > than image.defaul under (package) raster's hood.
> >
> > Cheers, Mike.
>
> > On both computers i can plot lines, points, polygons, as graphic
> > objects or shapefiles.
>
> > Thanks so much, Monica
>
> > The first PC that plots the raster:
> >
> > Sys.info()
> >
> > sysname release
> > version
> >
> > "Windows" "7 x64" "build 7601,
> > Service Pack 1"
> >
> > nodename machine
> > login
> >
> > "NODENAME" "x86-64"
> > "LOGIN"
> >
> > user effective_user
> >
> > "MONICA" "MONICA"
>
> > R.Version()
> >
> > $platform
> >
> > [1] "x86_64-w64-mingw32"
>
> > $arch
> >
> > [1] "x86_64"
>
> > $os
> >
> > [1] "mingw32"
>
> > $system
> >
> > [1] "x86_64, mingw32"
>
> > $status
> >
> > [1] ""
>
> > $major
> >
> > [1] "3"
>
> > $minor
> >
> > [1] "1.3"
>
> > $year
> >
> > [1] "2015"
>
> > $month
> >
> > [1] "03"
>
> > $day
> >
> > [1] "09"
>
> > $`svn rev`
> >
> > [1] "67962"
>
> > $language
> >
> > [1] "R"
>
> >
> > $version.string
> >
> > [1] "R version 3.1.3 (2015-03-09)"
>
> > $nickname
> >
> > [1] "Smooth Sidewalk"
>
> > Libraries i loaded: maptools, raster, rgdal, sp, CircStats, rgeos,
> stringr
>
> > The computer that does not plot the raster:
> >
> > Sys.info()
> >
> > sysname release
> > version nodename
> >
> > "Windows" "Server 2008 x64" "build 7601,
> > Service Pack 1" "NODENAME"
> >
> > machine login
> > user effective_user
> >
> > "x86-64" "MONICA"
> > "MONICA" "MONICA"
>
> > R.Version()
> >
> > $platform
> >
> > [1] "x86_64-w64-mingw32"
>
> > $arch
> >
> > [1] "x86_64"
>
> > $os
> >
> > [1] "mingw32"
>
> > $system
> >
> > [1] "x86_64, mingw32"
> >
>
> > $status
> >
> > [1] ""
> >
>
> > $major
> >
> > [1] "3"
>
> > $minor
> >
> > [1] "1.3"
> >
>
> > $year
> >
> > [1] "2015"
>
> > $month
> >
> > [1] "03"
> >
>
> > $day
> >
> > [1] "09"
>
> > $`svn rev`
> >
> > [1] "67962"
> >
>
> > $language
> >
> > [1] "R"
>
> > $version.string
> >
> > [1] "R version 3.1.3 (2015-03-09)"
>
> > $nickname
> >
> > [1] "Smooth Sidewalk"
>
> > Libraries i loaded: maptools, raster, rgdal, sp, CircStats, rgeos,
> stringr
>
> > again thanks so much,
> >
> > Monica
>
> > ______________________________________________
> > [hidden email]<mailto:[hidden email]> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.