Added function to align the figure automatically with the window. Iterations have to specified as a command line parameter.