[R] legend disappeared after pdf() export to file
Thierry Janssens
thierry.janssens at ecology.falw.vu.nl
Tue Sep 15 16:22:21 CEST 2009
Dear R-help,
I am trying to print a graph with an additional legend to a pdf() or
jpeg() file. Unfortunately the legend has completely disappeared in the
file (pdf of jpeg) compared to what is in the graphics device of the Rgui.
I positioned the legend after retrieving the x,y coordinates by the
locator() function. No adaptations to par() have been done.
The chunk of script is as follows (simplified for your convenience)
....
pdf("heatmappearson.pdf")
heatmap.2(cbind(tableTotalforCdheatmap$logFC[sig],
tableTotalforHeatheatmap$logFC[sig]), labRow =
tableTotalforCdheatmap$GeneName[sig], labCol = c("Cd", "Heat"), cexRow =
0.1 , cexCol = 0.9, col = rbg, key = TRUE, keysize = 1, density.info =
"none", trace = "none", symkey = FALSE, Rowv = TRUE, Colv = FALSE,
dendrogram = "row", hclustfun = pearsonfun, RowSideColors = rowcol[sig])
legend(x= 0.84, y = 2.5, legend=legend, fill = c("green", "yellow",
"orange"))
dev.off()
> sessionInfo()
R version 2.8.1 (2008-12-22)
i386-pc-mingw32
locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
Kingdom.1252;LC_MONETARY=English_United
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
attached base packages:
[1] grid stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] gplots_2.7.0 caTools_1.9 bitops_1.0-4.1 gdata_2.4.2
gtools_2.5.0-1
[6] statmod_1.3.8 marray_1.20.0 limma_2.16.4
loaded via a namespace (and not attached):
[1] tools_2.8.1
Any help is welcome.
kind regards,
Thierry Janssens
--
Thierry K.S. Janssens
Vrije Universiteit Amsterdam
Faculty of Earth and Life Sciences
Institute of Ecological Science
Department of Animal Ecology,
De Boelelaan 1085
1081 HV AMSTERDAM, The Netherlands
Phone: +31 (0)20-5989147
Fax: +31 (0)20-5987123
thierry.janssens at ecology.falw.vu.nl
More information about the R-help
mailing list