Skip to content

Commit 7e3696f

Browse files
Add support to draw _sum attributes in Drawer
1 parent 02592ba commit 7e3696f

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

src/spine/vis/out.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -588,13 +588,6 @@ def _object_colors(self, obj_name, attrs, color_attr, split_traces):
588588
cmin = 0
589589
cmax = count - 1
590590

591-
elif color_attr.startswith("is_"):
592-
# Boolean
593-
color = np.array(color, dtype=np.int32)
594-
colorscale = PLOTLY_COLORS_WGRAY[1:3]
595-
cmin = 0
596-
cmax = 1
597-
598591
elif color_attr == "shape" or color_attr == "pid":
599592
# Fixed length values, with potentially invalid values
600593
ref = SHAPE_LABELS if color_attr == "shape" else PID_LABELS
@@ -603,6 +596,19 @@ def _object_colors(self, obj_name, attrs, color_attr, split_traces):
603596
cmin = -1
604597
cmax = num_classes - 1
605598

599+
elif color_attr.startswith("is_"):
600+
# Boolean
601+
color = np.array(color, dtype=np.int32)
602+
colorscale = PLOTLY_COLORS_WGRAY[1:3]
603+
cmin = 0
604+
cmax = 1
605+
606+
elif color_attr.endswith("_sum"):
607+
# Continuous values
608+
colorscale = "Inferno"
609+
cmin = 0.0
610+
cmax = np.max(color) if len(color) > 0 else 1.0
611+
606612
elif color_attr.endswith("id"):
607613
# Variable-lengh discrete values
608614
unique, color = np.unique(color, return_inverse=True)

0 commit comments

Comments
 (0)