[R] How to interpret and modify "plot.svm"?
fhduan at gmail.com
Wed Dec 22 05:39:32 CET 2004
Thank you, Dr. Meyer. I updated the e1071 package but still can't find
the other three arguments for plot.svm. In addition, I can plot a
gray-colored contour region by adding the argument "col = c(gray(0.2),
gray(0.8))". But I failed to change those colored "x" or "o" points
into the shapes I want. Basically, I don't want to have any color in
the plot. Could you give me a hint how to do that?
The code I am using to plot the gray-contour figure is:
m <- svm(****, data = mydata)
plot(m, mydata, col = c(gray(0.2), gray(0.8)))
Thank you very much and Merry Xmas.
On Fri, 17 Dec 2004 18:46:07 +0100, David Meyer
<david.meyer at wu-wien.ac.at> wrote:
> > 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?
> The colors represent the classes of the data points. The help page
> admittedly doesn't tell you this and deserves improvement.
> > 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?
> I just added three arguments to plot.svm() that allow customizing of the
> plot symbols. The contour region is controlled by the parameters of the
> filled.contour() function used in plot.svm(), so you will need to add
> the color.palette argument to plot.svm (which subsequently will be
> passed to filled.contour()).
> > 3. Is it possible for me to draw a "hyperplane" on the plot?
> You can add arbitrary objects to the plot (try lines()); but plot.svm()
> doesn't compute the boundaries.
> > 4. What is the algorithm to plot the contour region?
> see filled.contour(). The input is determined by a grid of predicted
> > Thank you very much,
> > Frank
> Dr. David Meyer
> Department of Information Systems
> Vienna University of Economics and Business Administration
> Augasse 2-6, A-1090 Wien, Austria, Europe
> Fax: +43-1-313 36x746
> Tel: +43-1-313 36x4393
> HP: http://wi.wu-wien.ac.at/~meyer/
More information about the R-help