Skip to content

Commit

Permalink
update label assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Dec 17, 2024
1 parent ea1d8d3 commit 9fc8810
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pca/pca.py
Original file line number Diff line number Diff line change
Expand Up @@ -1512,7 +1512,8 @@ def _plot_loadings(self, topfeat, n_feat, PC, d3, arrowdict, fig, ax, verbose):
texts = []
for i in range(0, n_feat):
getfeat = topfeat['feature'].iloc[i]
label = getfeat + ' (' + ('%.3g' %topfeat['loading'].iloc[i]) + ')'
# label = getfeat + ' (' + ('%.3g' %topfeat['loading'].iloc[i]) + ')'
label = f"{getfeat} ({topfeat['loading'].iloc[i]:.3g})"
getcoef = coeff[getfeat].values
# Set first PC vs second PC direction. Note that these are not neccarily the best loading.
xarrow = getcoef[0] * scale # First PC in the x-axis direction
Expand Down

0 comments on commit 9fc8810

Please sign in to comment.