erdogant / pca

pca: A Python Package for Principal Component Analysis.
https://erdogant.github.io/pca
MIT License
286 stars 43 forks source link

request: option to not show biplot, and pass back fig, ax only #8

Closed jcpeterson closed 4 years ago

jcpeterson commented 4 years ago

in jupyter notebooks, it's difficult to use the axes passed back because plt.show has already been called

erdogant commented 4 years ago

This is fixed with the visible parameter now.

pip install -U pca

import pca
print(pca.__version__)

should be >='1.3.0'

Example:

from pca import pca
# Initialize
model = pca()

# Example with DataFrame
X = np.array(np.random.normal(0, 1, 500)).reshape(100, 5)
X = pd.DataFrame(data=X, columns=np.arange(0, X.shape[1]).astype(str))

# Fit transform
out = model.fit_transform(X)

# Make plot with parameters.
fig, ax = model.biplot(visible=False)

# Set the figure again to True and show the figure.
fig.set_visible(True)
fig
erdogant commented 4 years ago

Did you check wether this solves your issue? If yes, lets close the issue.