[R] change colors/ symbols of lda plots

Uwe Ligges ligges at statistik.tu-dortmund.de
Sat May 26 17:50:36 CEST 2012


On 25.05.2012 21:50, dgates at huskers.unl.edu wrote:
> Greetings R experts,
>
> I am running a simple lda on some simulation data of mine to show an illustration of my multivariate response data, since it is a simulation I have a very large amount of data and the default on plot seems to plot the category names. This is very difficult to interpret even changing the abbreviations. At the expense of sounding naive, my question(s) are:
>
> How can I color code my four categories?
>
> and how can I change the unit display to something simple like a dot, and not the names or abbreviated names of the categories?
>
>> From what I read I believe there is code for doing this in the Modern Applied Statistics With S text but this is currently checked out of my local library. I hope this is simple and straightforward enough of a question I could provide example code if necessary.



Just read ?plot.lda.

Example:

  ldaobject <- lda(Species~., data=iris)
  plot(ldaobject, panel = function(x, y, ...) points(x, y, ...),
     col = as.integer(iris$Species), pch = 20)

I think it is worth having a copy of MASS in your book shelf, not only 
in the local library....

Best,
Uwe Ligges




> Cheers,
> -Dan
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



More information about the R-help mailing list