Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove marginal plot grids as hardcoded default #1863

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions packages/python/plotly/plotly/express/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,17 +374,26 @@ def configure_cartesian_marginal_axes(args, fig, orders):
set_cartesian_axis_opts(args, xaxis, "x", orders)

# Configure axis ticks on marginal subplots
# Don't change the marginal grid settings if the template already specifies `showgrid`
if (
args["template"].layout.xaxis.showgrid is None
or args["template"].layout.yaxis.showgrid is None
):
grid_set = False
else:
grid_set = True

if args["marginal_x"]:
fig.update_yaxes(
showticklabels=False, showgrid=args["marginal_x"] == "histogram", row=nrows
)
fig.update_xaxes(showgrid=True, row=nrows)
fig.update_yaxes(showticklabels=False, showline=False, ticks="", row=nrows)
if not grid_set:
fig.update_yaxes(showgrid=args["marginal_x"] == "histogram", row=nrows)
fig.update_xaxes(showgrid=True, row=nrows)

if args["marginal_y"]:
fig.update_xaxes(
showticklabels=False, showgrid=args["marginal_y"] == "histogram", col=ncols
)
fig.update_yaxes(showgrid=True, col=ncols)
fig.update_xaxes(showticklabels=False, showline=False, ticks="", col=ncols)
if not grid_set:
fig.update_xaxes(showgrid=args["marginal_y"] == "histogram", col=ncols)
fig.update_yaxes(showgrid=True, col=ncols)

# Add axis titles to non-marginal subplots
y_title = get_decorated_label(args, args["y"], "y")
Expand Down