Revert "Fix problem with legend if data has NaN's"

This reverts commit 304ddd302571a5e17d6cfb375c48aa05f31f91c1.