DOC Fix matplotlib warning for plot_iris_dataset.py
Partially fix
@@ -21,7 +21,6 @@ information on this dataset.
# License: BSD 3 clause
import matplotlib.pyplot as plt
-from mpl_toolkits.mplot3d import Axes3D
from sklearn import datasets
from sklearn.decomposition import PCA
@@ -49,7 +48,8 @@ plt.yticks(())
# To getter a better understanding of interaction of the dimensions
# plot the first three PCA dimensions
fig = plt.figure(1, figsize=(8, 6))
-ax = Axes3D(fig, elev=-150, azim=110)
+ax = fig.add_subplot(111, projection="3d", elev=-150, azim=110)
+
X_reduced = PCA(n_components=3).fit_transform(iris.data)
ax.scatter(
X_reduced[:, 0],
@@ -60,6 +60,7 @@ ax.scatter(
edgecolor="k",
s=40,
)
+
ax.set_title("First three PCA directions")
ax.set_xlabel("1st eigenvector")
ax.w_xaxis.set_ticklabels([])
