[BioC] Correlation plot in R
lcarvalh at btk.fi
lcarvalh at btk.fi
Thu Apr 19 08:47:54 CEST 2012
I have a problem when creating a correlation plot when called within a
function, if called directly there is no problem. Can anyone find out why? The
code is below.
Code:
load("norm.matrix.RData")
require(lattice)
#This works and the figure is produced:
png(file="correlation.png", width=600, height=600)
levelplot(cor(data), col.regions = rainbow(100,start=.1, end=.35),scales =
list(x = list(rot = 45)), ylab="", xlab="", main="" )
dev.off()
#The following does not produce a figure, why?
saveCorrelationPlot <- function(data, fName) {
#quartz()
x11()
png(file=fName, width=600, height=600)
levelplot(cor(data), col.regions = rainbow(100,start=.1, end=.35),scales =
list(x = list(rot = 45)), ylab="", xlab="", main="" )
dev.off()
}
saveCorrelationPlot(data, "correlation2.png")
Thanks,
Leonor
More information about the Bioconductor
mailing list