eventloop for ploting devices
R_ProcessEvents only in interactive mode
fix indentation issue