Displaying 20 results from an estimated 30000 matches similar to: "Basic Question about Upgrading to Newer Version of R"
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,]
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
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()
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)
>
2010 Nov 29
1
map() and pdf clipping
Hello,
Below is a function (test.map) that permits drawing the same map using
three different devices. The "pdf" device doesn't clip polygons to
the plot region as I see it does by both the native device (in my case
"Quartz") and the "png" device.
test.map("pdf") # produces "test-map.pdf" with no clipping
test.map("png") #
2020 Oct 02
1
What is the threshold for `useRaster` of graphics::image()?
Hi R-help list
What is the threshold for the `useRaster` argument of graphics::image()
to decide whether a grid is "regular" or not (i.e. the usage of
useRaster=T is allowed or not). My
`dev.capabilities("rasterImage")$rasterImage` is "yes".
I could not find this information in the internet. I also could not find
the source code of the graphics::image() function (I
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
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
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
2011 Nov 16
2
strange behavior from cex="*"
Someone inquired on StackOverflow about apparently non-deterministic
graphics behaviour in R. I noticed that they were using cex="*" and
discovered some potentially weird behavior.
On repeated runs of the same code I can get different PNGs. If I set
the number of runs high enough, I seem to be able to get R to hang.
If I do a single version plotting to an interactive graphics
2010 Jul 26
1
Problem upgrading to 2.11
Hello,
I am trying to upgrade to 2.11 from 2.10 in the hopes of gaining
TCL/TK capabilities (let's pretend for the moment that this should
work). I've added "deb http://cran.stat.ucla.edu/bin/linux/ubuntu
lucid/" to /etc/apt/sources.list as described in the guide and have
run
apt-get update
apt-get install r-base r-base-dev
Things seem to work. When I look at the installed
2011 May 04
2
Is this confict of different versions of R or something else?
Hello!
I have had some problems lately with use of R at home and school. At my home
laptop (Ubuntu linux 64bit & R-2.12.0) R works just fine. But when I take my
codes to school(Windows XP 32bit & R-2.10.1 I think) and run those there
those codes probably won't work. Functions as combinations() didn't work and
expand.grid() worked a bit differently. About expand.grid I just
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 Nov 08
1
Unexpected behavior with cat
I am experiencing unexpected behavior with the command cat under
Window GUI builds of R version 2.12.0 (it does not seem to be an issue
in Rterm). For example if I issue the command cat(70,"\r") I get back
text that looks like Asian characters. If I highlight and copy that
text, it is the text I would regularly expect, e.g. the number 70 and
the prompt line. Highlighting the text
2011 Jun 13
3
plotting on an image
Hello all,
has someone please a few hints about how to
1.st: draw an image (preferrably a jpg) and then
2nd: plot() on that image
I am using a mac - and after searching and trying different ways (I have installed EBImage) I now would like to ask for help...
Thanks!
Johann