Skip to content

Commit 6d598fc

Browse files
authored
Remove the hatched background from functions (#601)
Previously, the graph explorer had made functions stand out via giving them a hatched background. However, functions are intended to seamlessly integrate into the graph, so remove the hatch. @wchargin brought up some good points. * The nodes are extremely hard to read. To quote from pgfmanual (3.0.1a, 95): Do not use background patterns, like a crosshatch or diagonal lines, instead of colors. They distract. Background patterns in information graphics are _evil_. * We already have a "Usages of the Function" section within the info card that shows up when either a function template or one of its calls is selected. This suffices to identify the node as being associated with a function. * We already have triangles within function nodes that uniquely identify function input and output ops.
1 parent 1b37e48 commit 6d598fc

File tree

3 files changed

+17
-64
lines changed

3 files changed

+17
-64
lines changed

Diff for: tensorboard/plugins/graph/tf_graph/tf-graph-scene.html

+15-42
Original file line numberDiff line numberDiff line change
@@ -48,53 +48,36 @@
4848

4949
/* --- Node and annotation-node for Metanode --- */
5050

51-
::content .meta > .nodeshape > rect.nodecolortarget,
52-
::content .meta > .annotation-node > rect.nodecolortarget {
53-
fill: hsl(0, 0%, 70%);
54-
}
55-
56-
::content .meta > .nodeshape > rect.function-indicator-layer,
57-
::content .meta > .annotation-node > rect.function-indicator-layer {
58-
fill: url(#stripe-pattern);
59-
fill-opacity: 0.07;
60-
}
61-
62-
::content .node.meta > .nodeshape > rect.event-handling-layer,
63-
::content .node.meta > .annotation-node > rect.event-handling-layer {
51+
::content .meta > .nodeshape > rect,
52+
::content .meta > .annotation-node > rect {
6453
cursor: pointer;
65-
fill-opacity: 0;
54+
fill: hsl(0, 0%, 70%);
6655
}
67-
68-
::content .node.meta.highlighted > .nodeshape > rect.event-handling-layer,
69-
::content .node.meta.highlighted > .annotation-node > rect.event-handling-layer {
56+
::content .node.meta.highlighted > .nodeshape > rect,
57+
::content .node.meta.highlighted > .annotation-node > rect {
7058
stroke-width: 2;
7159
}
72-
73-
::content .annotation.meta.highlighted > .nodeshape > rect.event-handling-layer,
74-
::content .annotation.meta.highlighted > .annotation-node > rect.event-handling-layer {
60+
::content .annotation.meta.highlighted > .nodeshape > rect,
61+
::content .annotation.meta.highlighted > .annotation-node > rect {
7562
stroke-width: 1;
7663
}
77-
78-
::content .meta.selected > .nodeshape > rect.event-handling-layer,
79-
::content .meta.selected > .annotation-node > rect.event-handling-layer {
64+
::content .meta.selected > .nodeshape > rect,
65+
::content .meta.selected > .annotation-node > rect {
8066
stroke: red;
8167
stroke-width: 2;
8268
}
83-
84-
::content .node.meta.selected.expanded > .nodeshape > rect.event-handling-layer,
85-
::content .node.meta.selected.expanded > .annotation-node > rect.event-handling-layer {
69+
::content .node.meta.selected.expanded > .nodeshape > rect,
70+
::content .node.meta.selected.expanded > .annotation-node > rect {
8671
stroke: red;
8772
stroke-width: 3;
8873
}
89-
90-
::content .annotation.meta.selected > .nodeshape > rect.event-handling-layer,
91-
::content .annotation.meta.selected > .annotation-node > rect.event-handling-layer {
74+
::content .annotation.meta.selected > .nodeshape > rect,
75+
::content .annotation.meta.selected > .annotation-node > rect {
9276
stroke: red;
9377
stroke-width: 2;
9478
}
95-
96-
::content .node.meta.selected.expanded.highlighted > .nodeshape > rect.event-handling-layer,
97-
::content .node.meta.selected.expanded.highlighted > .annotation-node > rect.event-handling-layer {
79+
::content .node.meta.selected.expanded.highlighted > .nodeshape > rect,
80+
::content .node.meta.selected.expanded.highlighted > .annotation-node > rect {
9881
stroke: red;
9982
stroke-width: 4;
10083
}
@@ -111,7 +94,6 @@
11194
stroke: #e0d4b3 !important;
11295
}
11396

114-
11597
::content .faded path {
11698
stroke-width: 1px !important;
11799
}
@@ -641,15 +623,6 @@
641623
<feMergeNode in="SourceGraphic"/>
642624
</feMerge>
643625
</filter>
644-
645-
<!-- A striped background pattern. -->
646-
<pattern id="stripe-pattern"
647-
width="6"
648-
height="6"
649-
patternTransform="rotate(45)"
650-
patternUnits="userSpaceOnUse">
651-
<rect width="3" height="6" fill="#000"></rect>
652-
</pattern>
653626
</defs>
654627
<!-- Make a large rectangle that fills the svg space so that
655628
zoom events get captured on safari -->

Diff for: tensorboard/plugins/graph/tf_graph_common/node.ts

+2-18
Original file line numberDiff line numberDiff line change
@@ -517,24 +517,8 @@ export function buildShape(nodeGroup, d, nodeClass: string): d3.Selection<any, a
517517
.attr('rx', d.radius).attr('ry', d.radius);
518518
break;
519519
case NodeType.META:
520-
// Create 1 rect that will be responsible for coloring (by structure,
521-
// device, etc).
522-
const rects = [
523-
scene.selectOrCreateChild(
524-
shapeGroup, 'rect', Class.Node.COLOR_TARGET)];
525-
if ((d.node as Metanode).associatedFunction) {
526-
// Create a rect that uses a pattern to distinguish this shape as a
527-
// TensorFlow function.
528-
rects.push(scene.selectOrCreateChild(
529-
shapeGroup, 'rect', Class.Node.FUNCTION_INDICATOR_LAYER));
530-
}
531-
// Create a rect for actually handling events (clicks, etc).
532-
rects.push(scene.selectOrCreateChild(
533-
shapeGroup, 'rect', Class.Node.EVENT_HANDLING_LAYER));
534-
// Round the corners of the rects.
535-
_.forEach(rects, rect => {
536-
rect.attr('rx', d.radius).attr('ry', d.radius);
537-
});
520+
scene.selectOrCreateChild(shapeGroup, 'rect', Class.Node.COLOR_TARGET)
521+
.attr('rx', d.radius).attr('ry', d.radius);
538522
break;
539523
default:
540524
throw Error('Unrecognized node type: ' + d.node.type);

Diff for: tensorboard/plugins/graph/tf_graph_common/scene.ts

-4
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ module tf.graph.scene {
2626
SHAPE: 'nodeshape',
2727
// <*> element(s) under SHAPE that should receive color updates.
2828
COLOR_TARGET: 'nodecolortarget',
29-
// The layer (or shape in the stack) that handles events (clicks, etc).
30-
EVENT_HANDLING_LAYER: 'event-handling-layer',
31-
// The layer that visually distinguishes a shape as a TensorFlow function.
32-
FUNCTION_INDICATOR_LAYER: 'function-indicator-layer',
3329
// <text> element showing the node's label.
3430
LABEL: 'nodelabel',
3531
// <g> element that contains all visuals for the expand/collapse

0 commit comments

Comments
 (0)