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

Release 4.1.0 #1704

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

Merged
merged 14 commits into from
Aug 7, 2019
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix plotly express marginals
Go back to start_cell bottom-left since that makes marginal code easier.
Now flip the row index of traces before they are inserted in the grid.
  • Loading branch information
jonmmease committed Aug 6, 2019
commit 589460cb11b7e6647a8ab8d0669d37c1398d00f9
29 changes: 19 additions & 10 deletions 29 packages/python/plotly/plotly/express/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,18 @@ def configure_cartesian_marginal_axes(args, fig, orders):

# Add axis titles to non-marginal subplots
y_title = get_decorated_label(args, args["y"], "y")
for row in range(1, nrows):
fig.update_yaxes(title_text=y_title, row=row, col=1)
if args["marginal_x"]:
fig.update_yaxes(title_text=y_title, row=1, col=1)
else:
for row in range(1, nrows + 1):
fig.update_yaxes(title_text=y_title, row=row, col=1)

x_title = get_decorated_label(args, args["x"], "x")
for col in range(1, ncols):
fig.update_xaxes(title_text=x_title, row=1, col=col)
if args["marginal_y"]:
fig.update_xaxes(title_text=x_title, row=1, col=1)
else:
for col in range(1, ncols + 1):
fig.update_xaxes(title_text=x_title, row=1, col=col)

# Configure axis type across all x-axes
if "log_x" in args and args["log_x"]:
Expand Down Expand Up @@ -393,8 +399,7 @@ def configure_cartesian_axes(args, fig, orders):

# Set x-axis titles and axis options in the bottom-most row
x_title = get_decorated_label(args, args["x"], "x")
nrows = len(fig._grid_ref)
for xaxis in fig.select_xaxes(row=nrows):
for xaxis in fig.select_xaxes(row=1):
xaxis.update(title_text=x_title)
set_cartesian_axis_opts(args, xaxis, "x", orders)

Expand Down Expand Up @@ -959,7 +964,7 @@ def make_figure(args, constructor, trace_patch={}, layout_patch={}):
row = m.val_map[val]
trace._subplot_row_val = val
else:
if trace_spec.marginal == "x":
if has_marginal_x and trace_spec.marginal != "x":
row = 2
else:
row = 1
Expand Down Expand Up @@ -1040,7 +1045,11 @@ def make_figure(args, constructor, trace_patch={}, layout_patch={}):
continue

_set_trace_grid_reference(
trace, fig.layout, fig._grid_ref, trace._subplot_row, trace._subplot_col
trace,
fig.layout,
fig._grid_ref,
nrows - trace._subplot_row + 1,
trace._subplot_col,
)

# Add traces, layout and frames to figure
Expand Down Expand Up @@ -1123,13 +1132,13 @@ def init_figure(
specs=specs,
shared_xaxes="all",
shared_yaxes="all",
row_titles=row_titles,
row_titles=list(reversed(row_titles)),
column_titles=column_titles,
horizontal_spacing=horizontal_spacing,
vertical_spacing=vertical_spacing,
row_heights=row_heights,
column_widths=column_widths,
start_cell="top-left",
start_cell="bottom-left",
)

# Remove explicit font size of row/col titles so template can take over
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.