adding sorting option on plot