LegendPar categorized with Spatial Heatmap error

I’m having trouble defining a LegendPar categorized together with the SpatialHeatmap component when the domain goes from 0 to 1 (Pass/Fail). I’m getting this error in the SpatialHeatmap:

Runtime error (IndexOutOfRangeException): index out of range: 1

line 188, in , “C:\Program Files\ladybug_tools\python\Lib\site-packages\ladybug\legend.py”
line 583, in color, “C:\Program Files\ladybug_tools\python\Lib\site-packages\ladybug\color.py”
line 188, in value_colors, “C:\Program Files\ladybug_tools\python\Lib\site-packages\ladybug\legend.py”
line 213, in value_colors, “C:\Program Files\ladybug_tools\python\Lib\site-packages\ladybug\graphic.py”
line 95, in script

This is how i’m trying to do:

The bottom option is the one that should be: One value for the domain (I tried also the panel with one value), 2 colors and 2 categories.
The option at the top is the one i’m using now just to see this working, but is not fine since it has an additional, not necessary color and category.
What i’m missing?


Hey @AbrahamYezioro ,

You need to plug in a single value for _domain in order to use the component like that. This single value should be the threshold at which something switches from being fail to pass.

Here’s an example:

l_par_categorized.gh (61.0 KB)

Thanks @chris,
I believe i get into a case where it is not working. My understanding of the component was ok but i can’t get why it is failing.
Attached my case, below your example, where you can see the fail. It is based on an old file you did, checking the view for LEED. The grid values are either 0 or 1. The domain only value should be 1, but still it fails.
If you get the chance to check it it will be great.
l_par_categorized_AY.gh (94.3 KB)

Hey @AbrahamYezioro ,

The reason is that 1 really isn’t the threshold at which something switches between pass and fail. Rather, it’s in between 0 and 1 where the switch happens. Setting the threshold perfectly equal to 1 means that it’s ambiguous what exactly 1 means and so the script gets confused. I’ll see if I can think of a better error message for this case but you can get your script to work the way you want by setting the _domain value to be equal to anything in between 0 and 1, like 0.5:

l_par_categorized_CWM.gh (91.3 KB)

1 Like

So simple. Perfect.
Thanks @chris!