Skip to content

Commit 26fbd43

Browse files
unset marginal ranges
1 parent 5f87ec4 commit 26fbd43

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
1010
- Fixed bug in `hover_data` argument of `px` functions, when the column name is changed with labels and `hover_data` is a dictionary setting up a specific format for the hover data ([#2544](https://github.com/plotly/plotly.py/pull/2544)).
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))
13+
- Plotly Express `range_(x|y)` should not impact the unlinked range of marginal subplots ([#2600](https://github.com/plotly/plotly.py/pull/2600))
1314

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

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

+6-2
Original file line numberDiff line numberDiff line change
@@ -543,14 +543,18 @@ def configure_cartesian_marginal_axes(args, fig, orders):
543543

544544
# Configure axis ticks on marginal subplots
545545
if args["marginal_x"]:
546-
fig.update_yaxes(showticklabels=False, showline=False, ticks="", row=nrows)
546+
fig.update_yaxes(
547+
showticklabels=False, showline=False, ticks="", range=None, row=nrows
548+
)
547549
if args["template"].layout.yaxis.showgrid is None:
548550
fig.update_yaxes(showgrid=args["marginal_x"] == "histogram", row=nrows)
549551
if args["template"].layout.xaxis.showgrid is None:
550552
fig.update_xaxes(showgrid=True, row=nrows)
551553

552554
if args["marginal_y"]:
553-
fig.update_xaxes(showticklabels=False, showline=False, ticks="", col=ncols)
555+
fig.update_xaxes(
556+
showticklabels=False, showline=False, ticks="", range=None, col=ncols
557+
)
554558
if args["template"].layout.xaxis.showgrid is None:
555559
fig.update_xaxes(showgrid=args["marginal_y"] == "histogram", col=ncols)
556560
if args["template"].layout.yaxis.showgrid is None:

Diff for: packages/python/plotly/plotly/tests/test_core/test_px/test_px.py

+15
Original file line numberDiff line numberDiff line change
@@ -238,3 +238,18 @@ def test_permissive_defaults():
238238
msg = "'PxDefaults' object has no attribute 'should_not_work'"
239239
with pytest.raises(AttributeError, match=msg):
240240
px.defaults.should_not_work = "test"
241+
242+
243+
def test_marginal_ranges():
244+
df = px.data.tips()
245+
fig = px.scatter(
246+
df,
247+
x="total_bill",
248+
y="tip",
249+
marginal_x="histogram",
250+
marginal_y="histogram",
251+
range_x=[5, 10],
252+
range_y=[5, 10],
253+
)
254+
assert fig.layout.xaxis2.range is None
255+
assert fig.layout.yaxis3.range is None

0 commit comments

Comments
 (0)