plot2d function