MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / svg_node

Function svg_node

experiments/human_eval/draw_llm_token_cost_tree.py:169–177  ·  view source on GitHub ↗
(x: float, y: float, text: str, font_size: int, color: tuple[int, int, int])

Source from the content-addressed store, hash-verified

167
168
169def svg_node(x: float, y: float, text: str, font_size: int, color: tuple[int, int, int]) -> list[str]:
170 # Fixed-size nodes are sufficient here because all labels are known.
171 widths = {"TokenCost": 150, "Closed API": 160, "Open / open-access": 245}
172 w = widths[text]
173 h = 44
174 return [
175 f'<rect x="{x - w / 2}" y="{y - h / 2}" width="{w}" height="{h}" rx="8" fill="white" stroke="{rgb(color)}" stroke-width="2"/>',
176 f'<text x="{x}" y="{y + 8}" font-family="Times New Roman" font-size="{font_size}" font-weight="700" text-anchor="middle" fill="{rgb(color)}">{text}</text>',
177 ]
178
179
180def write_svg() -> None:

Callers 1

write_svgFunction · 0.85

Calls 1

rgbFunction · 0.70

Tested by

no test coverage detected