Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f8f202a

Browse filesBrowse files
Merge pull request #2599 from plotly/wide_line_group
set line_group in wide mode
2 parents 26fbd43 + c712acd commit f8f202a
Copy full SHA for f8f202a

File tree

Expand file treeCollapse file tree

3 files changed

+20
-0
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+20
-0
lines changed

‎CHANGELOG.md

Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1111
- Made the Plotly Express `trendline` argument more robust and made it work with datetime `x` values ([#2554](https://github.com/plotly/plotly.py/pull/2554))
1212
- Plotly Express wide mode now accepts mixed integer and float columns ([#2598](https://github.com/plotly/plotly.py/pull/2598))
1313
- Plotly Express `range_(x|y)` should not impact the unlinked range of marginal subplots ([#2600](https://github.com/plotly/plotly.py/pull/2600))
14+
- `px.line` now sets `line_group=<variable>` in wide mode by default ([#2599](https://github.com/plotly/plotly.py/pull/2599))
1415

1516
## [4.8.1] - 2020-05-28
1617

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

Copy file name to clipboardExpand all lines: packages/python/plotly/plotly/express/_core.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,8 @@ def build_dataframe(args, constructor):
14221422
args["y" if orient_v else "x"] = value_name
14231423
if constructor != go.Histogram2d:
14241424
args["color"] = args["color"] or var_name
1425+
if "line_group" in args:
1426+
args["line_group"] = args["line_group"] or var_name
14251427
if constructor == go.Bar:
14261428
if _is_continuous(df_output, value_name):
14271429
args["x" if orient_v else "y"] = wide_cross_name

‎packages/python/plotly/plotly/tests/test_core/test_px/test_px_wide.py

Copy file name to clipboardExpand all lines: packages/python/plotly/plotly/tests/test_core/test_px/test_px_wide.py
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,3 +748,20 @@ def test_mixed_number_input():
748748
df = pd.DataFrame(dict(a=[1, 2], b=[1.1, 2.1]))
749749
fig = px.line(df)
750750
assert len(fig.data) == 2
751+
752+
753+
def test_line_group():
754+
df = pd.DataFrame(
755+
data={
756+
"who": ["a", "a", "b", "b"],
757+
"x": [0, 1, 0, 1],
758+
"score": [1.0, 2, 3, 4],
759+
"miss": [3.2, 2.5, 1.3, 1.5],
760+
}
761+
)
762+
fig = px.line(df, x="x", y=["miss", "score"])
763+
assert len(fig.data) == 2
764+
fig = px.line(df, x="x", y=["miss", "score"], color="who")
765+
assert len(fig.data) == 4
766+
fig = px.scatter(df, x="x", y=["miss", "score"], color="who")
767+
assert len(fig.data) == 2

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.