refactiong plot