Skip to content

Instantly share code, notes, and snippets.

@drammock
Last active August 29, 2015 14:12
Show Gist options
  • Save drammock/39aa4662039e5b5bf0b2 to your computer and use it in GitHub Desktop.
Save drammock/39aa4662039e5b5bf0b2 to your computer and use it in GitHub Desktop.
Sample translation from phonR 0.4-2 to 1.0-0
# install the new version:
download.file("https://raw.githubusercontent.com/drammock/phonR/master/R/phonR.R", "phonR.R")
source("phonR.R")
# or, if you have devtools package, can use
# devtools::source_url("https://raw.githubusercontent.com/drammock/phonR/master/R/phonR.R")
# do the bark normalization before plotting:
BNF$f1bark <- normBark(BNF$f1)
BNF$f2bark <- normBark(BNF$f2)
# new plotting command:
with(BNF, plotVowels(f1bark, f2bark, vowel, alpha.tokens=0.3, cex.tokens=0.6,
plot.means=TRUE, pch.means=vowel, cex.means=1.2,
ellipse.line=TRUE, xlab="F2 (Bark)", ylab="F1 (Bark)",
cex.axis=0.8, family="FreeSerif", pretty=TRUE, col="black",
xlim=c(16, 6), ylim=c(10, 2), xpd=TRUE))
@drammock
Copy link
Author

drammock commented Jan 5, 2015

NOTES:

  1. Because you have data points with F2 values outside the range of 6:16 bark, you may need to specify xpd=TRUE to ensure those values still get plotted.
  2. Usually you only need to specify width, height, pointsize, units, res if you are plotting direct-to-file (i.e., if output is something other than "screen").
  3. These (and other) arguments are no longer used in phonR 1.0-0: single.plot, titles, axis.titles, ignore.hidden, garnish.col, grayscale, vary.colors, vary.shapes, vary.lines. Most of them have been replaced by more standard R graphical arguments like main, sub, xlab and ylab for the axis and plot titles. vary.colors etc, have been replaced by var.col.by and var.style.by, but your plot was all one color anyway so that shouldn't matter in this case. ignore.hidden and single.plot are removed in favor of base R handling of multiple plots and axis limits, via par(mfrow(...)) and xlim/ylim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment