Fix error with threshold in legend