erdogant / pca

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

request: turn off datapoints in biplot #6

Closed jcpeterson closed 4 years ago

jcpeterson commented 4 years ago

get directions only

erdogant commented 4 years ago

I released a new version for this issue. Update your release with:

pip install -U pca

Check version. Should be >= 1.2.0 print(pca.__version__)

Now you can remove your datapoints with the colormap functionality. By default I set the cmap='Set1' but if you now set cmap to None. No points are shown. Well actually they are plotted but in white. I need the points to do some calculations later on. I will also include this example in the readme file.

Try out:

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
model.biplot(cmap=None, label=False, legend=False)
jcpeterson commented 4 years ago

great, thank you