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

Function make_trace_spec

plotly/express/_core.py:910–984  ·  view source on GitHub ↗
(args, constructor, attrs, trace_patch)

Source from the content-addressed store, hash-verified

908
909
910def make_trace_spec(args, constructor, attrs, trace_patch):
911 if constructor in [go.Scatter, go.Scatterpolar]:
912 if "render_mode" in args and (
913 args["render_mode"] == "webgl"
914 or (
915 args["render_mode"] == "auto"
916 and len(args["data_frame"]) > 1000
917 and args.get("line_shape") != "spline"
918 and args["animation_frame"] is None
919 )
920 ):
921 if constructor == go.Scatter:
922 constructor = go.Scattergl
923 if "orientation" in trace_patch:
924 del trace_patch["orientation"]
925 else:
926 constructor = go.Scatterpolargl
927 # Create base trace specification
928 result = [TraceSpec(constructor, attrs, trace_patch, None)]
929
930 # Add marginal trace specifications
931 for letter in ["x", "y"]:
932 if "marginal_" + letter in args and args["marginal_" + letter]:
933 trace_spec = None
934 axis_map = dict(
935 xaxis="x1" if letter == "x" else "x2",
936 yaxis="y1" if letter == "y" else "y2",
937 )
938 if args["marginal_" + letter] == "histogram":
939 trace_spec = TraceSpec(
940 constructor=go.Histogram,
941 attrs=[letter, "marginal_" + letter],
942 trace_patch=dict(opacity=0.5, bingroup=letter, **axis_map),
943 marginal=letter,
944 )
945 elif args["marginal_" + letter] == "violin":
946 trace_spec = TraceSpec(
947 constructor=go.Violin,
948 attrs=[letter, "hover_name", "hover_data"],
949 trace_patch=dict(scalegroup=letter),
950 marginal=letter,
951 )
952 elif args["marginal_" + letter] == "box":
953 trace_spec = TraceSpec(
954 constructor=go.Box,
955 attrs=[letter, "hover_name", "hover_data"],
956 trace_patch=dict(notched=True),
957 marginal=letter,
958 )
959 elif args["marginal_" + letter] == "rug":
960 symbols = {"x": "line-ns-open", "y": "line-ew-open"}
961 trace_spec = TraceSpec(
962 constructor=go.Box,
963 attrs=[letter, "hover_name", "hover_data"],
964 trace_patch=dict(
965 fillcolor="rgba(255,255,255,0)",
966 line={"color": "rgba(255,255,255,0)"},
967 boxpoints="all",

Callers 1

infer_configFunction · 0.85

Calls 2

make_trendline_specFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected