optimize plot