added plotting utility for 2D and 3D plots