[R] Legend on plots when using Cairo

audrey audrey at ebi.ac.uk
Tue Apr 8 11:22:49 CEST 2008


Dear all,

I am trying to use the Cairo package to avoid some X11 issues and it 
works very well. However, when I want to add a legend to my plots, I 
receive an error message from Cairo:

 > library(Cairo)
 > CairoPNG(file="test.png")
 > plot(1:100)
 > dev.off()
null device
          1
This works fine. But:

 > CairoPNG(file="test.png")
 > plot(1:100)
 > legend(50,50,"test")
Error in strwidth(legend, units = "user", cex = cex) :
  font 2147483647 not recognized in Rcairo_setup_font
 > dev.off()
null device
          1

Does anyone know how to obtain a plot with legend using Cairo?

I have tried it on two different environments, so here are the two 
sessionInfo():

 > sessionInfo()
R version 2.8.0 Under development (unstable) (2008-04-07 r45137)
i686-pc-linux-gnu

locale:
C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

other attached packages:
[1] Cairo_1.4-2    fortunes_1.3-3

###############
 > sessionInfo()
R version 2.8.0 Under development (unstable) (2008-04-07 r45137)
x86_64-unknown-linux-gnu

locale:
LC_CTYPE=en_US.ISO-8859-1;LC_NUMERIC=C;LC_TIME=en_US.ISO-8859-1;LC_COLLATE=en_US.ISO-8859-1;LC_MONETARY=C;LC_MESSAGES=en_US.ISO-8859-1;LC_PAPER=en_US.ISO-8859-1;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.ISO-8859-1;LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

other attached packages:
[1] Cairo_1.4-2    fortunes_1.3-3

Best regards,
Audrey



More information about the R-help mailing list