8000 [MRG] remove "matplotlib <1" compatibility code from manifold exampl… · scikit-learn/scikit-learn@d0ce40e · GitHub
[go: up one dir, main page]

Skip to content

Commit d0ce40e

Browse files
rishikksh20lesteve
authored andcommitted
[MRG] remove "matplotlib <1" compatibility code from manifold examples (#8552)
1 parent 34a3c99 commit d0ce40e

File tree

4 files changed

+10
-20
lines changed

4 files changed

+10
-20
lines changed

README.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ scikit-learn requires:
5353
- NumPy (>= 1.6.1)
5454
- SciPy (>= 0.9)
5555

56+
For running the examples Matplotlib >= 1.1.1 is required.
57+
5658
scikit-learn also uses CBLAS, the C interface to the Basic Linear Algebra
5759
Subprograms library. scikit-learn comes with a reference implementation, but
5860
the system CBLAS will be detected by the build system and used if present.

examples/manifold/plot_compare_methods.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,10 @@
4343
plt.suptitle("Manifold Learning with %i points, %i neighbors"
4444
% (1000, n_neighbors), fontsize=14)
4545

46-
try:
47-
# compatibility matplotlib < 1.0
48-
ax = fig.add_subplot(251, projection='3d')
49-
ax.scatter(X[:, 0], X[:, 1], X[:, 2], c=color, cmap=plt.cm.Spectral)
50-
ax.view_init(4, -72)
51-
except:
52-
ax = fig.add_subplot(251, projection='3d')
53-
plt.scatter(X[:, 0], X[:, 2], c=color, cmap=plt.cm.Spectral)
46+
47+
ax = fig.add_subplot(251, projection='3d')
48+
ax.scatter(X[:, 0], X[:, 1], X[:, 2], c=color, cmap=plt.cm.Spectral)
49+
ax.view_init(4, -72)
5450

5551
methods = ['standard', 'ltsa', 'hessian', 'modified']
5652
labels = ['LLE', 'LTSA', 'Hessian LLE', 'Modified LLE']

examples/manifold/plot_manifold_sphere.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@
6868

6969
ax = fig.add_subplot(251, projection='3d')
7070
ax.scatter(x, y, z, c=p[indices], cmap=plt.cm.rainbow)
71-
try:
72-
# compatibility matplotlib < 1.0
73-
ax.view_init(40, -10)
74-
except:
75-
pass
71+
ax.view_init(40, -10)
7672

7773
sphere_data = np.array([x, y, z]).T
7874

examples/manifold/plot_swissroll.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,9 @@
3333
# Plot result
3434

3535
fig = plt.figure()
36-
try:
37-
# compatibility matplotlib < 1.0
38-
ax = fig.add_subplot(211, projection='3d')
39-
ax.scatter(X[:, 0], X[:, 1], X[:, 2], c=color, cmap=plt.cm.Spectral)
40-
except:
41-
ax = fig.add_subplot(211)
42-
ax.scatter(X[:, 0], X[:, 2], c=color, cmap=plt.cm.Spectral)
36+
37+
ax = fig.add_subplot(211, projection='3d')
38+
ax.scatter(X[:, 0], X[:, 1], X[:, 2], c=color, cmap=plt.cm.Spectral)
4339

4440
ax.set_title("Original data")
4541
ax = fig.add_subplot(212)

0 commit comments

Comments
 (0)
0