plot betadisper, change of pch
On May 9, 2012, at 6:20 AM, Albin Blaschka wrote:
Hello! After performing an analysis with betadisper, package vegan I would like to plot the results - so far, so good. But I would also like to "tune" a little bit the plotting characters, as '+' and 'x' are a little to similar... My (boiled down) code: [See session info at the bottom of the mail, vegan is vegan_2.0-3] mod <- betadisper(mydata, mygroups, type='median') syms <- c(rep(1:4, each = 16)) modplot <- plot(mod, axes = c(1,2), main='', pch=syms) I get the error message (roughly translated from german): "formal argument 'pch' fits to more given arguments" [formales Argument "pch" passt zu mehreren gegebenen Argumenten] What do I have to change?
In such an instance you generally need to get the code of a possibly hidden function named "plot.<class-returned-by-betadisp>" where you get the class by running: class(mod) # then type plot.<that-result> # and if that fails getAnywhere(plot.<that-result>) Then go in and either add a 'pch' argument or change the hardcoded values in the function body. As it turns out you can see the function without even loading vegan just by doing this: vegan:::plot.betadisper 'pch' appears a couple of times and it is colliding with your values in the points() calls. The function should probably be written so that it can accept a 'pch' argument.
David. > > Thank you in advance! > Albin > > > sessionInfo() > R version 2.15.0 (2012-03-30) > Platform: x86_64-pc-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=de_AT.UTF-8 LC_NUMERIC=C > LC_TIME=de_AT.UTF-8 LC_COLLATE=de_AT.UTF-8 > [5] LC_MONETARY=de_AT.UTF-8 LC_MESSAGES=de_AT.UTF-8 > LC_PAPER=C LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > LC_MEASUREMENT=de_AT.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] rgl_0.92.798 reshape_0.8.4 plyr_1.7.1 > MASS_7.3-16 vegan_2.0-3 permute_0.7-0 RPostgreSQL_0.3-2 > [8] DBI_0.2-5 > > loaded via a namespace (and not attached): > [1] grid_2.15.0 lattice_0.20-6 tools_2.15.0 > > > -- > | Albin Blaschka, Mag.rer.nat. > | Etrichstrasse 26, A-5020 Salzburg > | * www.albinblaschka.info * www.thinkanimal.info * > | - It's hard to live in the mountains, hard but not hopeless! > > ______________________________________________ > 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. David Winsemius, MD West Hartford, CT