[R-lang] vowel space ellipses (and IPA fonts)

Roger Levy rlevy at ucsd.edu
Mon Jun 11 11:30:31 PDT 2007


Hi James,

Some more suggestions on your code:

Lngmyers wrote:

> (2) How do I get the axes to appear on the right and top, instead of 
> left and bottom? I couldn't find parameters for doing this without 
> drawing the whole thing piece by piece.

You can suppress printing of the x and y axis ticks respectively by 
passing the parameters xaxt="n" and yaxt="n" in to data.ellipse, and 
cause them to be printed on the top and right by calling axis(3) and 
axis(4) afterward:


if (dots) {
   data.ellipse(F2.F1[Vowel==vn[1]], F1[Vowel==vn[1]], levels=prob,
    col="black", lty=1,
    ylim=c(max(F1),min(F1)),xlim=c(max(F2.F1),min(F2.F1)),
    xlab = "F2-F1 (Hz)", ylab = "F1 (Hz)",xaxt="n",yaxt="n")
axis(3)
axis(4)


It's definitely worth the time investment to read the documentation to 
par {graphics} from beginning to end! There are a lot of neat things in 
there.

The bad news is that I'm not sure exactly how to get the axis labels 
(the words, not the ticks) to print on the right and top. You might try 
playing with the mgp parameter.  If you figure out how to do it, 
definitely let us know!

> (4) Does anybody else have problems getting "else" to work right? I 
> always end up having to use a series of disjunctive "if"s....

The R language definition explains why you can't put an "else" on a new 
line in the top level of a script, as Stefan pointed out:

http://cran.r-project.org/doc/manuals/R-lang.html#Operator-tokens

Hope this helps!

Best

Roger


-- 

Roger Levy                      Email: rlevy at ucsd.edu
Assistant Professor             Phone: 858-534-7219
Department of Linguistics       Fax:   858-534-4789
UC San Diego                    Web:   http://ling.ucsd.edu/~rlevy


More information about the R-lang mailing list