[R] greek symbols using pch

Earl F. Glynn efg at stowers-institute.org
Mon Oct 10 17:12:02 CEST 2005


"FISCHER, Matthew" <mjf at ansto.gov.au> wrote in message
news:283982AD9F3CD211B3AC00A0C983032F11443674 at paradise.ansto.gov.au...

>     In a plot, can I specify pch to be a greek symbol? (I looked at
> show.pch() in the Hmisc package but couldn't see the right symbols in
there).
> If not, I guess I can get around this using text(x,y,expression()).

I'm not sure where this is explained very well.  Having ?font give a clue
about this would be nice.

Use font=5, the symbol font.  To see what's in font=5:

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, 1:16)
axis(LEFT  <-2, at=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+1)
}

The Greek letters are from 65 to 90 and 97 to 122 in this font.

Here are random points with Greek letters as the plot character:

par(font=5)
# Use Greek letter for plot characters from font=5
plot(0:1, 0:1, axes=F, type="n", xlab="", ylab="",
  main="Greek plotting characters")
box()
points(runif(100), runif(100), pch=c(65:90, 97:122))

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




More information about the R-help mailing list