setplot function updated for 2D