graphviz
Functionality to display the tracer as a visual graph.
It first convert it to a graph, using visual_graph.py
, and then renders
that with graphviz.
add_legend(dot, options)
¶
Add a legend with nodes and edge styles.
Creates one node for each node style and one edge for each edge style.
It was difficult to get it to appear in a way that didn't disrupt the main graph. It was easiest to get it to be a vertically aligned column of nodes, on the left of the graph. To do this, I link all the nodes with invisible edges so they stay vertically aligned.
https://stackoverflow.com/a/52300532/907060.
Source code in lineapy/visualizer/graphviz.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
|
edge_labels(options)
¶
Labels for the edge types to use in the legend,
Source code in lineapy/visualizer/graphviz.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
|
extra_label_labels(options)
¶
Labels for the extra label, to use in the legend,
Source code in lineapy/visualizer/graphviz.py
165 166 167 168 169 170 171 172 173 174 175 176 |
|
extra_labels_to_html(extra_labels, highlighted)
¶
Convert extra labels into an HTML table, where each label is a row. A single node could have multiple variables and artifacts pointing at it. So we make a table with a row for each artifact. Why a table? Well we are putting it in the xlabel and a table was an easy way to have multiple rows with different colors.
Source code in lineapy/visualizer/graphviz.py
237 238 239 240 241 242 243 244 245 246 247 248 |
|
get_color(tp, highlighted)
¶
Get the color for a type. Note that graphviz colorscheme indexing is 1 based
Source code in lineapy/visualizer/graphviz.py
198 199 200 201 202 203 |
|