[R] image() with a vector
Dieter Menne
dieter.menne at menne-biomed.de
Wed Feb 16 08:16:07 CET 2011
Steven Cordwell wrote:
>
> However, transforming z into a matrix with two rows, where both rows are
> the same as z above does seem to be a workaround.
>
> z <- matrix(c(z,z),2,length(z),byrow=TRUE)
> y <- c(0.25,0.75)
> image(x,y,t(z),zlim=c(1,7),col=heat.colors(7),xlab="Year",ylab="Action",yaxt="n",xaxs="r",yaxs="r")
>
> The problem is that when I include the figure that is produced in my pdf,
> there ends up being a white line that runs through the middle horizontally
> (where the divison of the cells is) which ruins the presentation of
This looks more like a problem of pdf than one of image. Under Windows and
current R, I cannot reproduce the line in the pdf, but we have seen this
before. If you are sure that you have the current version of R installed,
you could send in a bug report, but make sure sessionInfo() is included.
One workaround that worked for me in the past to use a CairoPDF as show
below.
Dieter
library(Cairo)
CairoPDF(file="c:/tmp/Hello.pdf")
x <- 0:20
y <- 0.5
z <- round(runif(21,1,7))
z <- matrix(c(z,z),2,length(z),byrow=TRUE)
y <- c(0.25,0.75)
image(x,y,t(z),zlim=c(1,7),col=heat.colors(7),xlab="Year",ylab="Action",
yaxt="n",xaxs="r",yaxs="r")
dev.off()
--
View this message in context: http://r.789695.n4.nabble.com/image-with-a-vector-tp3308265p3308283.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list