added auto resizing to the figure