Fix for plot dimension error when resizing window