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

Function _facet_grid

plotly/figure_factory/_facet_grid.py:508–645  ·  view source on GitHub ↗
(
    df,
    x,
    y,
    facet_row,
    facet_col,
    num_of_rows,
    num_of_cols,
    facet_row_labels,
    facet_col_labels,
    trace_type,
    flipped_rows,
    flipped_cols,
    show_boxes,
    SUBPLOT_SPACING,
    marker_color,
    kwargs_trace,
    kwargs_marker,
)

Source from the content-addressed store, hash-verified

506
507
508def _facet_grid(
509 df,
510 x,
511 y,
512 facet_row,
513 facet_col,
514 num_of_rows,
515 num_of_cols,
516 facet_row_labels,
517 facet_col_labels,
518 trace_type,
519 flipped_rows,
520 flipped_cols,
521 show_boxes,
522 SUBPLOT_SPACING,
523 marker_color,
524 kwargs_trace,
525 kwargs_marker,
526):
527 fig = make_subplots(
528 rows=num_of_rows,
529 cols=num_of_cols,
530 shared_xaxes=True,
531 shared_yaxes=True,
532 horizontal_spacing=SUBPLOT_SPACING,
533 vertical_spacing=SUBPLOT_SPACING,
534 print_grid=False,
535 )
536 annotations = []
537 if not facet_row and not facet_col:
538 trace = dict(
539 type=trace_type,
540 marker=dict(color=marker_color, line=kwargs_marker["line"]),
541 **kwargs_trace,
542 )
543
544 if x:
545 trace["x"] = df[x]
546 if y:
547 trace["y"] = df[y]
548 trace = _make_trace_for_scatter(
549 trace, trace_type, marker_color, **kwargs_marker
550 )
551
552 fig.append_trace(trace, 1, 1)
553
554 elif (facet_row and not facet_col) or (not facet_row and facet_col):
555 groups_by_facet = list(df.groupby(facet_row if facet_row else facet_col))
556 for j, group in enumerate(groups_by_facet):
557 trace = dict(
558 type=trace_type,
559 marker=dict(color=marker_color, line=kwargs_marker["line"]),
560 **kwargs_trace,
561 )
562
563 if x:
564 trace["x"] = group[1][x]
565 if y:

Callers 1

create_facet_gridFunction · 0.85

Calls 5

make_subplotsFunction · 0.90
_make_trace_for_scatterFunction · 0.85
_return_labelFunction · 0.85
_annotation_dictFunction · 0.85
append_traceMethod · 0.80

Tested by

no test coverage detected