"""
===========================================
SVM: Maximum separating margin hyperplane
===========================================

"""

import numpy as np
import pylab as pl
from scikits.learn import svm

# we create 40 separable points
np.random.seed(0)
X = np.r_[np.random.randn(20, 2) - [2,2], np.random.randn(20, 2) + [2, 2]]
Y = [0]*20 + [1]*20

# fit the model
clf = svm.SVC(kernel='linear')
clf.fit(X, Y)

# get the separating hyperplane
w =  clf.coef_[0]
a = -w[0]/w[1]
xx = np.linspace(-5, 5)
yy = a*xx - (clf.intercept_[0])/w[1]

# plot the parallels to the separating hyperplane that pass through the
# support vectors
b = clf.support_[0]
yy_down = a*xx + (b[1] - a*b[0])
b = clf.support_[-1]
yy_up = a*xx + (b[1] - a*b[0])

# plot the line, the points, and the nearest vectors to the plane
pl.set_cmap(pl.cm.Paired)
pl.plot(xx, yy, 'k-')
pl.plot(xx, yy_down, 'k--')
pl.plot(xx, yy_up, 'k--')
pl.scatter(X[:,0], X[:,1], c=Y)
pl.scatter(clf.support_[:,0], clf.support_[:,1], marker='+')

pl.axis('tight')
pl.show()


@@ -54,16 +54,23 @@
 Maximum 
+margin 
 separati
@@ -72,23 +72,16 @@
 arating 
-margin 
 hyperpla
@@ -128,16 +128,162 @@
 ======%0A%0A
+Plot the maximum margin separating hyperplane within a two-class%0Aseparable dataset using a Support Vector Machines classifier with%0Alinear kernel.%0A
 %22%22%22%0A%0Aimp
@@ -789,16 +789,24 @@
 support_
+vectors_
 %5B0%5D%0Ayy_d
@@ -850,16 +850,24 @@
 support_
+vectors_
 %5B-1%5D%0Ayy_
@@ -1118,16 +1118,24 @@
 support_
+vectors_
 %5B:,0%5D, c
@@ -1149,24 +1149,31 @@
 ort_
-%5B:,1%5D, marker='+
+vectors_%5B:,1%5D, c='white
 ')%0A%0A

Update svm examples affected by latest API changes.