Fix plot location calculation code.