MCPcopy Index your code
hub / github.com/plotly/plotly.py / configure_cartesian_marginal_axes

Function configure_cartesian_marginal_axes

plotly/express/_core.py:655–717  ·  view source on GitHub ↗
(args, fig, orders)

Source from the content-addressed store, hash-verified

653
654
655def configure_cartesian_marginal_axes(args, fig, orders):
656 nrows = len(fig._grid_ref)
657 ncols = len(fig._grid_ref[0])
658
659 # Set y-axis titles and axis options in the left-most column
660 for yaxis in fig.select_yaxes(col=1):
661 set_cartesian_axis_opts(args, yaxis, "y", orders)
662
663 # Set x-axis titles and axis options in the bottom-most row
664 for xaxis in fig.select_xaxes(row=1):
665 set_cartesian_axis_opts(args, xaxis, "x", orders)
666
667 # Configure axis ticks on marginal subplots
668 if args["marginal_x"]:
669 fig.update_yaxes(
670 showticklabels=False, showline=False, ticks="", range=None, row=nrows
671 )
672 if args["template"].layout.yaxis.showgrid is None:
673 fig.update_yaxes(showgrid=args["marginal_x"] == "histogram", row=nrows)
674 if args["template"].layout.xaxis.showgrid is None:
675 fig.update_xaxes(showgrid=True, row=nrows)
676
677 if args["marginal_y"]:
678 fig.update_xaxes(
679 showticklabels=False, showline=False, ticks="", range=None, col=ncols
680 )
681 if args["template"].layout.xaxis.showgrid is None:
682 fig.update_xaxes(showgrid=args["marginal_y"] == "histogram", col=ncols)
683 if args["template"].layout.yaxis.showgrid is None:
684 fig.update_yaxes(showgrid=True, col=ncols)
685
686 # Add axis titles to non-marginal subplots
687 y_title = get_decorated_label(args, args["y"], "y")
688 if args["marginal_x"]:
689 fig.update_yaxes(title_text=y_title, row=1, col=1)
690 else:
691 for row in range(1, nrows + 1):
692 fig.update_yaxes(title_text=y_title, row=row, col=1)
693
694 x_title = get_decorated_label(args, args["x"], "x")
695 if args["marginal_y"]:
696 fig.update_xaxes(title_text=x_title, row=1, col=1)
697 else:
698 for col in range(1, ncols + 1):
699 fig.update_xaxes(title_text=x_title, row=1, col=col)
700
701 # Configure axis type across all x-axes
702 if "log_x" in args and args["log_x"]:
703 fig.update_xaxes(type="log")
704
705 # Configure axis type across all y-axes
706 if "log_y" in args and args["log_y"]:
707 fig.update_yaxes(type="log")
708
709 # Configure matching and axis type for marginal y-axes
710 matches_y = "y" + str(ncols + 1)
711 if args["marginal_x"]:
712 for row in range(2, nrows + 1, 2):

Callers 1

configure_cartesian_axesFunction · 0.85

Calls 6

set_cartesian_axis_optsFunction · 0.85
get_decorated_labelFunction · 0.85
select_yaxesMethod · 0.45
select_xaxesMethod · 0.45
update_yaxesMethod · 0.45
update_xaxesMethod · 0.45

Tested by

no test coverage detected