MCPcopy
hub / github.com/dask/dask / svg_2d

Function svg_2d

dask/array/svg.py:49–85  ·  view source on GitHub ↗
(chunks, offset=(0, 0), skew=(0, 0), size=200, sizes=None)

Source from the content-addressed store, hash-verified

47
48
49def svg_2d(chunks, offset=(0, 0), skew=(0, 0), size=200, sizes=None):
50 shape = tuple(map(sum, chunks))
51 sizes = sizes or draw_sizes(shape, size=size)
52 y, x = grid_points(chunks, sizes)
53
54 lines, (min_x, max_x, min_y, max_y) = svg_grid(
55 x, y, offset=offset, skew=skew, size=size
56 )
57
58 header = '<svg width="{}" height="{}" style="stroke:rgb(0,0,0);stroke-width:1" >\n'.format(
59 int(max_x + 50), int(max_y + 50)
60 )
61 footer = "\n</svg>"
62
63 if shape[0] >= 100:
64 rotate = -90
65 else:
66 rotate = 0
67
68 text = [
69 "",
70 " <!-- Text -->",
71 ' <text x="{}" y="{}" {} >{}</text>'.format(
72 max_x / 2, max_y + 20, text_style, shape[1]
73 ),
74 ' <text x="{}" y="{}" {} transform="rotate({},{},{})">{}</text>'.format(
75 max_x + 20,
76 max_y / 2,
77 text_style,
78 rotate,
79 max_x + 20,
80 max_y / 2,
81 shape[0],
82 ),
83 ]
84
85 return header + "\n".join(lines + text) + footer
86
87
88def svg_3d(chunks, size=200, sizes=None, offset=(0, 0)):

Callers 2

svgFunction · 0.85
svg_1dFunction · 0.85

Calls 4

draw_sizesFunction · 0.85
grid_pointsFunction · 0.85
svg_gridFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…