Skip to content

Commit 16b0e67

Browse files
More flexible parallel_categories magic
1 parent 37c8c81 commit 16b0e67

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

Diff for: packages/python/plotly/plotly/express/_chart_types.py

+1
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,7 @@ def parallel_categories(
12051205
template=None,
12061206
width=None,
12071207
height=None,
1208+
dimensions_max_cardinality=50,
12081209
):
12091210
"""
12101211
In a parallel categories (or parallel sets) plot, each row of

Diff for: packages/python/plotly/plotly/express/_core.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ def make_trace_kwargs(args, trace_spec, g, mapping_labels, sizeref):
181181
)
182182
and (
183183
trace_spec.constructor != go.Parcats
184-
or len(args["data_frame"][name].unique()) <= 20
184+
or (v is not None and name in v)
185+
or len(args["data_frame"][name].unique())
186+
<= args["dimensions_max_cardinality"]
185187
)
186188
]
187189
result["dimensions"] = [

Diff for: packages/python/plotly/plotly/express/_doc.py

+5
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@
106106
colref_list_desc,
107107
"Values from these columns are used for multidimensional visualization.",
108108
],
109+
dimensions_max_cardinality=[
110+
"int (default 50)",
111+
"When `dimensions` is `None` and `data_frame` is provided, "
112+
"columns with more than this number of unique values are excluded from the output.",
113+
],
109114
error_x=[
110115
colref_type,
111116
colref_desc,

0 commit comments

Comments
 (0)