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

Function _bullet

plotly/figure_factory/_bullet.py:13–179  ·  view source on GitHub ↗
(
    df,
    markers,
    measures,
    ranges,
    subtitles,
    titles,
    orientation,
    range_colors,
    measure_colors,
    horizontal_spacing,
    vertical_spacing,
    scatter_options,
    layout_options,
)

Source from the content-addressed store, hash-verified

11
12
13def _bullet(
14 df,
15 markers,
16 measures,
17 ranges,
18 subtitles,
19 titles,
20 orientation,
21 range_colors,
22 measure_colors,
23 horizontal_spacing,
24 vertical_spacing,
25 scatter_options,
26 layout_options,
27):
28 num_of_lanes = len(df)
29 num_of_rows = num_of_lanes if orientation == "h" else 1
30 num_of_cols = 1 if orientation == "h" else num_of_lanes
31 if not horizontal_spacing:
32 horizontal_spacing = 1.0 / num_of_lanes
33 if not vertical_spacing:
34 vertical_spacing = 1.0 / num_of_lanes
35 fig = plotly.subplots.make_subplots(
36 num_of_rows,
37 num_of_cols,
38 print_grid=False,
39 horizontal_spacing=horizontal_spacing,
40 vertical_spacing=vertical_spacing,
41 )
42
43 # layout
44 fig["layout"].update(
45 dict(shapes=[]),
46 title="Bullet Chart",
47 height=600,
48 width=1000,
49 showlegend=False,
50 barmode="stack",
51 annotations=[],
52 margin=dict(l=120 if orientation == "h" else 80),
53 )
54
55 # update layout
56 fig["layout"].update(layout_options)
57
58 if orientation == "h":
59 width_axis = "yaxis"
60 length_axis = "xaxis"
61 else:
62 width_axis = "xaxis"
63 length_axis = "yaxis"
64
65 for key in fig["layout"]:
66 if "xaxis" in key or "yaxis" in key:
67 fig["layout"][key]["showgrid"] = False
68 fig["layout"][key]["zeroline"] = False
69 if length_axis in key:
70 fig["layout"][key]["tickwidth"] = 1

Callers 1

create_bulletFunction · 0.85

Calls 3

updateMethod · 0.45
formatMethod · 0.45
add_traceMethod · 0.45

Tested by

no test coverage detected