Skip to content

Commit 2df0427

Browse files
committed
Merge branch 'plotly-with-narwhals' of https://github.com/FBruzzesi/plotly.py into plotly-with-narwhals
2 parents f102998 + b8ccec4 commit 2df0427

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

doc/python/ml-pca.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ px.area(
224224

225225
## Visualize Loadings
226226

227-
It is also possible to visualize loadings using `shapes`, and use `annotations` to indicate which feature a certain loading original belong to. Here, we define loadings as:
227+
It is also possible to visualize loadings using `shapes`, and use `annotations` to indicate which feature a certain loading originally belonged to. Here, we define loadings as:
228228

229229
$$
230230
loadings = eigenvectors \cdot \sqrt{eigenvalues}

packages/python/plotly/plotly/express/_core.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2637,18 +2637,12 @@ def make_figure(args, constructor, trace_patch=None, layout_patch=None):
26372637
group = group.sort(by=base, descending=False, nulls_last=True)
26382638

26392639
if args.get("ecdfmode", "standard") == "complementary":
2640-
group = group.with_columns(
2641-
((nw.col(var) - nw.lit(group_sum)) * (-1)).alias(var)
2642-
)
2640+
group = group.with_columns((group_sum - nw.col(var)).alias(var))
26432641

26442642
if args["ecdfnorm"] == "probability":
2645-
group = group.with_columns(
2646-
(nw.col(var) / nw.lit(group_sum)).alias(var)
2647-
)
2643+
group = group.with_columns(nw.col(var) / group_sum)
26482644
elif args["ecdfnorm"] == "percent":
2649-
group = group.with_columns(
2650-
(nw.col(var) / nw.lit(group_sum) * nw.lit(100.0)).alias(var)
2651-
)
2645+
group = group.with_columns((nw.col(var) / group_sum) * 100.0)
26522646

26532647
patch, fit_results = make_trace_kwargs(
26542648
args, trace_spec, group, mapping_labels.copy(), sizeref

0 commit comments

Comments
 (0)