MCPcopy Create free account
hub / github.com/FlashSampling/FlashSampling / _label_bar

Function _label_bar

benchmarking/plot_ncu_kernel_breakdown.py:187–201  ·  view source on GitHub ↗

Place a centered label inside a bar segment if it's tall enough.

(ax, rect, text: str, min_height: float = 0.3)

Source from the content-addressed store, hash-verified

185
186
187def _label_bar(ax, rect, text: str, min_height: float = 0.3) -> None:
188 """Place a centered label inside a bar segment if it's tall enough."""
189 h = rect.get_height()
190 if h < min_height:
191 return
192 ax.text(
193 rect.get_x() + rect.get_width() / 2,
194 rect.get_y() + h / 2,
195 text,
196 ha="center",
197 va="center",
198 fontsize=10,
199 color="white",
200 fontweight="bold",
201 )
202
203
204if __name__ == "__main__":

Callers 1

plot_breakdownFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected