MCPcopy Create free account
hub / github.com/plotly/plotly.py / test_pie_like_px

Function test_pie_like_px

tests/test_optional/test_px/test_px_functions.py:34–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32
33
34def test_pie_like_px():
35 # Pie
36 labels = ["Oxygen", "Hydrogen", "Carbon_Dioxide", "Nitrogen"]
37 values = np.array([4500, 2500, 1053, 500])
38
39 fig = px.pie(names=labels, values=values)
40 trace = go.Pie(labels=labels, values=values)
41 _compare_figures(trace, fig)
42
43 labels = ["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"]
44 parents = ["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve"]
45 values = np.array([10, 14, 12, 10, 2, 6, 6, 4, 4])
46 # Sunburst
47 fig = px.sunburst(names=labels, parents=parents, values=values)
48 trace = go.Sunburst(labels=labels, parents=parents, values=values)
49 _compare_figures(trace, fig)
50 # Treemap
51 fig = px.treemap(names=labels, parents=parents, values=values)
52 trace = go.Treemap(labels=labels, parents=parents, values=values)
53 _compare_figures(trace, fig)
54
55 # Funnel
56 x = ["A", "B", "C"]
57 y = np.array([3, 2, 1])
58 fig = px.funnel(y=y, x=x)
59 trace = go.Funnel(y=y, x=x)
60 _compare_figures(trace, fig)
61 # Funnelarea
62 fig = px.funnel_area(values=y, names=x)
63 trace = go.Funnelarea(values=y, labels=x)
64 _compare_figures(trace, fig)
65
66
67def test_pie_custom_category_order(constructor):

Callers

nothing calls this directly

Calls 6

_compare_figuresFunction · 0.85
pieMethod · 0.80
sunburstMethod · 0.80
treemapMethod · 0.80
funnelMethod · 0.80
arrayMethod · 0.45

Tested by

no test coverage detected