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

Function _get_subplot_ref_for_trace

plotly/_subplots.py:1515–1557  ·  view source on GitHub ↗
(trace)

Source from the content-addressed store, hash-verified

1513
1514
1515def _get_subplot_ref_for_trace(trace):
1516 if "domain" in trace:
1517 return SubplotRef(
1518 subplot_type="domain",
1519 layout_keys=(),
1520 trace_kwargs={"domain": {"x": trace.domain.x, "y": trace.domain.y}},
1521 )
1522
1523 elif "xaxis" in trace and "yaxis" in trace:
1524 xaxis_name = "xaxis" + trace.xaxis[1:] if trace.xaxis else "xaxis"
1525 yaxis_name = "yaxis" + trace.yaxis[1:] if trace.yaxis else "yaxis"
1526
1527 return SubplotRef(
1528 subplot_type="xy",
1529 layout_keys=(xaxis_name, yaxis_name),
1530 trace_kwargs={"xaxis": trace.xaxis, "yaxis": trace.yaxis},
1531 )
1532 elif "geo" in trace:
1533 return SubplotRef(
1534 subplot_type="geo",
1535 layout_keys=(trace.geo,),
1536 trace_kwargs={"geo": trace.geo},
1537 )
1538 elif "scene" in trace:
1539 return SubplotRef(
1540 subplot_type="scene",
1541 layout_keys=(trace.scene,),
1542 trace_kwargs={"scene": trace.scene},
1543 )
1544 elif "subplot" in trace:
1545 for t in _subplot_prop_named_subplot:
1546 try:
1547 validator = trace._get_prop_validator("subplot")
1548 validator.validate_coerce(t)
1549 return SubplotRef(
1550 subplot_type=t,
1551 layout_keys=(trace.subplot,),
1552 trace_kwargs={"subplot": trace.subplot},
1553 )
1554 except ValueError:
1555 pass
1556
1557 return None

Callers 1

Calls 2

_get_prop_validatorMethod · 0.45
validate_coerceMethod · 0.45

Tested by

no test coverage detected