Re: [R] font=5 (Was: greek symbols using pch)

From: Earl F. Glynn <efg_at_stowers-institute.org>
Date: Wed 12 Oct 2005 - 01:23:24 EST

"ecatchpole" <E.Catchpole@adfa.edu.au> wrote in message news:434B7B78.6020603@adfa.edu.au...
> Thanks for that. Very instructive, and much appreciated.
>
> And sorry, yes, I strayed well off the original topic. The Greek symbols
> come out fine with font=5 in my locale,
> Locale:
> LC_CTYPE=en_GB.UTF-8;
> LC_NUMERIC=C;
> LC_TIME=en_GB.UTF-8;
>
> I was interested in some of the other nice characters, for example
> \infty and \partial, that appear in the table, but with a calligraphic R
> attached to them. But plotmath() works fine, so I'm happy.

I performed some tests with font=5 on both Linux and Windows using source("font5.R"), which is shown below, and then calling the Font5Test() function.

Consistent results were seen with devices X11, png, and jpeg under either Linux (R 2.1.1) or Windows (R 2.2.0) in my locale. Oddly, both the pdf and postscript devices create 2 pages of output with the first page the expected table and a second unexpected page with only the "clubs suite" symbol (167) in the middle of the plot. I'd call this a bug, but I guess I haven't read all the documentation about this yet.

efg
Earl F. Glynn
Scientific Programmer
Stowers Institute for Medical Research

font5.R


ShowFont5 <- function()
{
  oldpar <- par(font=5, las=1)
  plot(0:1, 0:1, type="n")
  points(.5, .5, pch=167)
  par(font=5, las=1)
  plot(0:15,0:15,type="n",ylim=c(15,0),
    main="Symbols in Font=5",
    xlab="", ylab="",xaxt="n", yaxt="n")   axis(BOTTOM<-1, at=0:15)
  axis(LEFT <-2, at=0:15, 16*0:15)
  abline(v=0.5 + 0:14,

         h=0.5 + 0:14, col="grey", lty="dotted")   # pch index of any cell is 16*row + column   for(i in 0:255)
  {
    x <- i %%16;
    y <- i %/% 16;
    points(x,y,pch=i)
  }
  par(oldpar)
}

Font5Test <- function()
{
  X11()
  ShowFont5()

  dev.off()

  pdf("font5.pdf")
  ShowFont5()
  dev.off()

  png("font5.png")
  ShowFont5()
  dev.off()

  jpeg("font5.jpg")
  ShowFont5()
  dev.off()

  postscript("font5.ps")
  ShowFont5()
  dev.off()

}

Linux Test



> Sys.getlocale()

[1] "C"

> R.Version()

$platform
[1] "x86_64-unknown-linux-gnu"

$arch
[1] "x86_64"

$os
[1] "linux-gnu"

$system
[1] "x86_64, linux-gnu"

$status
[1] ""

$major
[1] "2"

$minor
[1] "1.1"

$year
[1] "2005"

$month
[1] "06"

$day
[1] "20"

$language
[1] "R"

Windows Test



> Sys.getlocale()

[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"

> R.Version()

$platform
[1] "i386-pc-mingw32"

$arch
[1] "i386"

$os
[1] "mingw32"

$system
[1] "i386, mingw32"

$status
[1] ""

$major
[1] "2"

$minor
[1] "2.0"

$year
[1] "2005"

$month
[1] "10"

$day
[1] "06"

$"svn rev"
[1] "35749"

$language
[1] "R"



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Oct 12 01:33:17 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:40:41 EST