updated the function plotFigure