[R] PDF file not created correctly

james.holtman@convergys.com james.holtman at convergys.com
Fri Jul 5 18:04:03 CEST 2002


I am trying to put some text data in a graphical output file so that I have
a single file with both the graphs and summary data.  I was capturing the
output via a 'sink(textConnection('output','w')).  This seems to work fine,
but in trying to put the text data in a graphics frame, I was having
problems.  When creating a postscript file, things were fine, but a PDF
file appeared not to be correct.

Here is a test file I created which appears to create the correct output
for postscript and BMP, but not for PDF.

platform i386-pc-mingw32
arch     i386
os       mingw32
system   i386, mingw32
status
major    1
minor    5.1
year     2002
month    06
day      17
language R



#=============================================================
x.buffer <- c('this is a test','next line') # create test data
#
# create a postscript file (OK)
#
postscript('test.ps')
par(mfrow=c(1,1))
plot.new()
text(par('usr')[1],par('usr')[4],paste(x.buffer, collapse='\n'), font=1,
    adj=c(0,1),cex=.8, col='red')
dev.off()
#
# now try is as a PDF file (EMPTY)
#
pdf('test.pdf')
par(mfrow=c(1,1))
plot.new()
text(par('usr')[1],par('usr')[4],paste(x.buffer, collapse='\n'), font=1,
    adj=c(0,1),cex=.8, col='red')
dev.off()
#
# now try BMP (OK)
#
bmp('test.bmp')
par(mfrow=c(1,1))
plot.new()
text(par('usr')[1],par('usr')[4],paste(x.buffer, collapse='\n'), font=1,
    adj=c(0,1),cex=.8, col='red')
dev.off()

#========================================================

Jim Holtman

--

NOTICE:  The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential.  If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected.


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list