[Plot] improved detection of discontinuous functions

improved detection of discontinuous functions