Displaying 20 results from an estimated 1000 matches similar to: "What is the threshold for `useRaster` of graphics::image()?"
2011 Feb 09
2
using rasterImage within image
Has anyone yet tried incorporating rasterImage into the base image()
function?  It seems to make a *huge* difference, with
a very small number of added/changed lines of code.  (Of course I have
barely tested it at all.)
  Is there any reason this *shouldn't* go into the next release?
> source("image.R")
> z <- matrix(runif(1e6),nrow=1000)
> image(z)
>
2014 Mar 20
0
possible bug: graphics::image seems to ignore getOption("preferRaster")
the details section of ?image says:
> If useRaster is not specified, raster images are used when the 
> getOption("preferRaster") is true, the grid is regular and either 
> dev.capabilities("raster") is "yes" or it is "non-missing" and there 
> are no missing values.
but in my experience this is never the case and 
2010 Oct 01
1
colored rasterImage()
Hello,
I have been exploring the possibility to transition some code that  
currently uses image() to use the new rasterImage().  To date, I  
haven't been able to specify a color look-up strategy that works.  For  
example...
nx <- 100
ny <- 100
m <- matrix(data = rep(seq(0,1, length = nx), ny), ncol = nx, nrow =  
ny, byrow = TRUE)
plot(1:nx, 1:ny, type = "n")
my.color
2010 Oct 01
2
strange interaction between rasterImage and Grid graphics
Dear all,
This may be specific to Mac, I haven't had a chance to test another
platform. Consider this,
plot(1,1,t="n")
rasterImage(matrix(1),1,1,1,1)
library(grid)
grid.rect(gp=gpar(fill="grey"))
The grid.rect covers the full device window as expected. However, when
I resize the window ever so slightly (interactive device) the rectGrob
is suddenly clipped to the previous
2010 Oct 18
1
Incorrect positioning of raster images on Windows
I am working on dumping raster data from R into PNG files using
rasterImage().  I am working with a test matrix from the rasterImage()
example and using it to produce a PNG image with the following code:
# From the example for rasterImage(). A 3 pixel by 5 pixel b/w checkerboard.
testImage <- as.raster(0:1, nrow=3, ncol=5)
testImage
     [,1]      [,2]      [,3]      [,4]      [,5]     
[1,]
2010 Oct 18
1
Incorrect positioning of raster images on Windows
I am working on dumping raster data from R into PNG files using
rasterImage().  I am working with a test matrix from the rasterImage()
example and using it to produce a PNG image with the following code:
# From the example for rasterImage(). A 3 pixel by 5 pixel b/w checkerboard.
testImage <- as.raster(0:1, nrow=3, ncol=5)
testImage
     [,1]      [,2]      [,3]      [,4]      [,5]     
[1,]
2012 Jan 11
1
Inconsistencies in device_Raster when axes are reflected
I noticed some undocumented and inconsistent behavior in device_Raster when a
plot is produced with reflected axes such as:
    image(volcano, xlim = c(1,0), useRaster = TRUE)
    image(volcano, ylim = c(1,0), useRaster = TRUE)
The `pdf` device will perform horizontal and vertical reflections, while
`quartz` will ignore the transformations when plotting to the screen, but
when plotting to a
2011 Feb 15
1
Using rasterImage on a CairoWin device prevents adding further elements to device?
I was pointed to the Cairo package for plotting PNG images on a
device. I've been playing around with it, but found that after I use
the rasterImage function, I can't add anything any more to the device,
eg :
img <- readPNG(system.file("img", "Rlogo.png", package="png"))
r = as.raster(img[,,1:3])
r[img[,,4] == 0] = "white"
CairoWin()
2010 Nov 17
1
rasterImage and coordinate conversion
Hi, I have a plot and I would like to overlay a PNG image over it. I'm
using the rasterImage function to do this, but the problem I'm facing
is working out the coordinates of the upper right corner of the final
image in user coordinates.
That is I can place the image so the lower left is located at the
bottom of the y-axis and the left end of the x-axis. Since my image is
say 100px x
2013 Mar 02
1
Raster images and saving with original pixel dimensions in tiff, jpeg, or png perferablly.
Hello R-Help,
I want to be able to read in a raster image, plot it with grid.raster
or rasterImage and save the image with one pixel per a pixel element
from my array. Saved preferably in a common image format.
The real goal of my question is to eventually read in images with text
on them, manipulate them with my controlled functions, save them
without changing the image dimensions, and perform
2012 May 07
1
Plotting a raster image
Hello,
I have a data frame which looks like
> head(d)
  a1 a2        n  j     col
1  1  1 88341002 11 #E7E7E7
2  1  2 25094882 11 #E7E7E7
3  1  3 16916246 11 #E7E7E7
4  1  4 14289229 11 #E7E7E7
5  1  5 11945929 11 #E7E7E7
6  1  6  8401235 11 #E7E7E7
The values in 'j' run from 1 to 11. I would like to plot the point (a1,a2)
with color given by j
I tried
 mi <-
2011 Sep 18
2
Add png image outside plot borders
I am trying to add a copyright disclaimer outside the plot borders of
some images I have created. I can use mtext() to add the written
portion, but I would like to have the Creative Commons license image
(http://en.wikipedia.org/wiki/File:Cc.logo.circle.svg) before the
text. I've found that I can plot a .png image inside the plot
boundaries using rasterImage() but I can't figure out how to
2017 Nov 01
2
Memory address of character datatype
Hi,
?
To get the memory address of where the value of variable "x" (of datatype "numeric") is stored one does the following in R (in 32 bit):
?
??? ? library(pryr)
? ?? ?x <- 1024
?? ?? addr <- as.numeric(address(x)) +?24?? ?# 24 is needed to jump the variable info and point to the data itself (i.e. 1024)
?
The question now is what is the value of the jump?so that one
2020 Mar 27
2
object.size vs lobstr::obj_size
On 3/27/20 12:00, Hadley Wickham wrote:
> 
> 
> On Fri, Mar 27, 2020 at 10:39 AM Herv? Pag?s <hpages at fredhutch.org 
> <mailto:hpages at fredhutch.org>> wrote:
> 
>     Hi Tomas,
> 
>     On 3/27/20 07:01, Tomas Kalibera wrote:
>      > they provide an over-approximation
> 
>     They can also provide an "under-approximation" (to say the
2010 Nov 29
1
Basic Question about Upgrading to Newer Version of R
Hey Everyone,
I'm using Ubuntu and used the Ubuntu Software Center to put R on my computer (version 2.10.1).  It has been working great for what I've needed it for.  However, I think now that I need a newer version so that a particular function in a new script I'd like to use can be found: rasterImage.  My basic question is how do I upgrade from 2.10.1 to 2.12.0?  The problems I'm
2011 Nov 20
1
place values into a matrix efficiently?
This question attacked me as I was thinking about matrix value updates.
I probably will never need to do this, but wanted to ask if there are 
efficient methods to perform the for-loop in the following sequence.
%xymat<-matrix(rep(0,100) nr=10,nc=10)  # empty matrix
%x<-1:10
%y<-sample.int(10,10,rep=T)
%for (j in 1:10) xymat[x[j],y[j]] <- some_function(x[j],y[j]) #to create 
either
2011 Sep 23
1
spatstat => owin + image
Dear Community
I am at my wits end and seek advice.
My wish is to plot coordinates (x,y in WGS84_UMTS for the ones interested)
of sampling points.
This I can do by the standard spatstat prodcedure via owin. I then try to
add an image, which is
a map/satellite photo in the background.
Firstly
Problem: With the current code, I can not get the edges of the image to
match the boarders of the plot
2011 Feb 14
1
readPNG gives warnings and doesn't execute sample code from help files
Dear all,
I noticed in the latest R version (R.2.12.1) that the readPNG gives
following warning when running the example code in the help file (or
when using any other png for that matter) :
50: In rasterImage(img, 1.2, 1.27, 1.8, 1.73) :
  Per-pixel alpha not supported on this device
No picture is shown, and code I used to be able to run, doesn't run any more.
> sessionInfo()
R version
2020 Mar 27
1
object.size vs lobstr::obj_size
On 3/27/20 15:19, Hadley Wickham wrote:
> 
> 
> On Fri, Mar 27, 2020 at 4:01 PM Herv? Pag?s <hpages at fredhutch.org 
> <mailto:hpages at fredhutch.org>> wrote:
> 
> 
> 
>     On 3/27/20 12:00, Hadley Wickham wrote:
>      >
>      >
>      > On Fri, Mar 27, 2020 at 10:39 AM Herv? Pag?s
>     <hpages at fredhutch.org <mailto:hpages at
2017 Nov 12
1
Array changing address unexpectedly
Hi David,
?
Thanks for the correction concerning the "else" issue.
?
Taking your code and removing some lines (to increase readability):
?
library(pryr)
?
data <- array(dim = c(5))
for(x in 1:5)
{
?? data[x] <- as.integer(x * 2)
}
?
#print(data)
?
add = address(data)
for(x in 1:5)
{
?? data[x] <- as.integer(0)
}
?
if (add == address(data))
{
print("Address did not