Search code examples
rscatter-plotdecision-tree

Colour Scatterplot based on decision tree route


I am using a data set about seeds that contains the headers [class , area, perimeter, compactness, length, Width Asymmetry, GrooveLength]

this is a classification exercise and I have a decision tree that looks like

Decision tree for the seed data

I have selected the two variables GrooveLength and Asymmetry, to plot on a scatter graph, which plots the whole tables points against each other,

Scatter Plot of GrooverLength/Asymmetry

my question is how do I colour code the points according to the decision tree output?

the plot is by using simply twopoints <- seedfull[,c(8,7)] plot(twopoints)


Solution

  • The Answer: including col = seeddata$class) to the plot