Skip to content

Commit

Permalink
Does k3d-jupyter support to render a time series of 3D volume? #444
Browse files Browse the repository at this point in the history
  • Loading branch information
artur-trzesiok committed Jan 6, 2024
1 parent 67541ab commit 9c9222f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions k3d/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def check_attribute_color_range(attribute, color_range=()):
Parameters
----------
attribute : list
attribute : list or dict (for timeseries)
Array of numbers.
color_range : tuple, optional
Two numbers, by default ().
Expand All @@ -224,10 +224,16 @@ def check_attribute_color_range(attribute, color_range=()):
tuple
Color range.
"""
if type(attribute) is dict or attribute.size == 0 or len(color_range) == 2:
return color_range

color_range = minmax(attribute)
if len(color_range) == 2:
return color_range
elif type(attribute) is dict:
t = [minmax(attribute[k]) for k in attribute.keys()]
color_range = [min([v[0] for v in t]), max([v[1] for v in t])]
elif attribute.size == 0:
return color_range
else:
color_range = minmax(attribute)

if color_range[0] == color_range[1]:
color_range[1] += 1.0
Expand Down

0 comments on commit 9c9222f

Please sign in to comment.