2

I am doing Linear Discriminant Analysis. The training dataset has two variables and ~100 rows, and 4 classes. I want to plot the prediction borders (on the plane of the original variables). I do it with klaR::partimat.

So far I have:

klaR::partimat(class ~  v1+ v2, data = dataset0, method = "lda", gs = NA), 

which gives me this Partiton Plot.

I want to remove the four black circles from the plot (representing the mains of each class). How can I do that?

Alternatively, how can I give different color to each point?

Ekatef
  • 1,061
  • 1
  • 9
  • 12
Contemplavit
  • 115
  • 1
  • 1
  • 10
  • Welcome to SO! Please find an answer below. Note, please that I had to use the standard `iris` dataset for illustration as you haven't included the dataset. Hope, it'll be helpful anyway. But it would be great if you would consider including a [minimal dataset](https://stackoverflow.com/a/5963610/8465924) into your questions in the future. – Ekatef Jan 17 '19 at 14:55

1 Answers1

1

An argument col.mean makes the job. If you want to remove the mean points from the plot the solution is to set col.mean = NA:

partimat(Species ~ Sepal.Length + Petal.Length, data = iris, 
    method = "lda", gs = NA, col.mean = NA)

enter image description here

Another option is to set the custom color set. The length of this color set should be equal to the numbers of the classes:

partimat(Species ~ Sepal.Length + Petal.Length, data = iris, 
    method = "lda", gs = NA, col.mean = c("darkblue", "forestgreen", "darkred"))

enter image description here

Ekatef
  • 1,061
  • 1
  • 9
  • 12