[R] How to interpret and modify "plot.svm"?

Liaw, Andy andy_liaw at merck.com
Fri Dec 17 12:32:09 CET 2004

David can give the definitive answers, but I'll give my take on this...

> From: Frank Duan
> Dear R people,
> I am trying to plot the results from running svm in library(e1071). I
> use plot.svm. After searching through the help archives and FAQ, I
> still have several questions:
> 1.  In default, crosses indicate support vectors. But why are there
> two colors of crosses? What do they represent?

SVs are part of the training data, and as such, have class labels, right?
> 2. I want to draw a white-gray colored plot and modify the different
> colored crosses or circles by different shaped points. Could anyone
> give me a hint?

Supposedly possible with the ... argument, but it's not clear how to do
that, unless you read the code (which you can, of course).  Looks like some
graphical parameters are hardwired in there, so you might need to modify it
to your own liking.
> 3. Is it possible for me to draw a "hyperplane" on the plot?

Not sure what you mean.  You are looking at a 2D subspace.  How do you want
to draw hyperplane on such subspace?
> 4. What is the algorithm to plot the contour region?

Again, you can look at the code.  It does the logical thing: predict() on a
regular grid and plot that.

> Thank you very much,
> Frank
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

More information about the R-help mailing list