[R] Legend on plots when using Cairo

From: audrey <audrey_at_ebi.ac.uk>
Date: Tue, 08 Apr 2008 10:22:49 +0100


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



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 08 Apr 2008 - 09:27:30 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 08 Apr 2008 - 10:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive