8000 DOC: use notebook-style for plot_pca_3d.py (#23064) · scikit-learn/scikit-learn@fbc56ed · GitHub
[go: up one dir, main page]

Skip to content

Commit fbc56ed

Browse files
nat-saltlesteve
andauthored
DOC: use notebook-style for plot_pca_3d.py (#23064)
Co-authored-by: Loïc Estève <loic.esteve@ymail.com>
1 parent 6a4a6af commit fbc56ed

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

examples/decomposition/plot_pca_3d.py

+15-7
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,13 @@
1515
# Kevin Hughes
1616
# License: BSD 3 clause
1717

18-
from sklearn.decomposition import PCA
18+
# %%
19+
# Create the data
20+
# ---------------
1921

2022
import numpy as np
21-
import matplotlib.pyplot as plt
22-
from scipy import stats
2323

24-
25-
# #############################################################################
26-
# Create the data
24+
from scipy import stats
2725

2826
e = np.exp(1)
2927
np.random.seed(4)
@@ -51,8 +49,18 @@ def pdf(x):
5149
b /= norm
5250

5351

54-
# #############################################################################
52+
# %%
5553
# Plot the figures
54+
# ----------------
55+
56+
from sklearn.decomposition import PCA
57+
58+
import matplotlib.pyplot as plt
59+
60+
# unused but required import for doing 3d projections with matplotlib < 3.2
61+
import mpl_toolkits.mplot3d # noqa: F401
62+
63+
5664
def plot_figs(fig_num, elev, azim):
5765
fig = plt.figure(fig_num, figsize=(4, 3))
5866
plt.clf()

0 commit comments

Comments
 (0)
0