MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / draw_body

Function draw_body

galleries/examples/specialty_plots/ishikawa_diagram.py:110–148  ·  view source on GitHub ↗

Place each problem section in its correct place by changing the coordinates on each loop. Parameters ---------- data : dict The input data (can be a dict of lists or tuples). ValueError is raised if more than six arguments are passed. Returns -------

(data: dict)

Source from the content-addressed store, hash-verified

108
109
110def draw_body(data: dict):
111 """
112 Place each problem section in its correct place by changing
113 the coordinates on each loop.
114
115 Parameters
116 ----------
117 data : dict
118 The input data (can be a dict of lists or tuples). ValueError
119 is raised if more than six arguments are passed.
120
121 Returns
122 -------
123 None.
124
125 """
126 # Set the length of the spine according to the number of 'problem' categories.
127 length = (math.ceil(len(data) / 2)) - 1
128 draw_spine(-2 - length, 2 + length)
129
130 # Change the coordinates of the 'problem' annotations after each one is rendered.
131 offset = 0
132 prob_section = [1.55, 0.8]
133 for index, problem in enumerate(data.values()):
134 plot_above = index % 2 == 0
135 cause_arrow_y = 1.7 if plot_above else -1.7
136 y_prob_angle = 16 if plot_above else -16
137
138 # Plot each section in pairs along the main spine.
139 prob_arrow_x = prob_section[0] + length + offset
140 cause_arrow_x = prob_section[1] + length + offset
141 if not plot_above:
142 offset -= 2.5
143 if index > 5:
144 raise ValueError(f'Maximum number of problems is 6, you have entered '
145 f'{len(data)}')
146
147 problems(list(data.keys())[index], prob_arrow_x, 0, -12, y_prob_angle)
148 causes(problem, cause_arrow_x, cause_arrow_y, top=plot_above)
149
150
151def draw_spine(xmin: int, xmax: int):

Callers 1

Calls 4

draw_spineFunction · 0.85
problemsFunction · 0.85
causesFunction · 0.85
valuesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…