writing the dynamics plotting