danjgale / surfplot

A package for publication-ready brain surface figures
https://surfplot.readthedocs.io/en/latest/
Other
50 stars 13 forks source link

`as_outline` and NaNs #4

Closed danjgale closed 2 years ago

danjgale commented 3 years ago

If a data array has NaNs and as_outline=True in Plot.add_layer(), then those NaN values will be filled in as borders, including the medial wall. This is not expected behaviour.

The simplest way around this is to use numpy's nan_to_num() just before calling get_labeling_border(). When zero_transparent=True, these values will return to NaN. I don't know if there's any use case that would require zero_transparent=False with as_outline=True, given that you probably don't want to outline 0 values in general.