Plotting during a loop in RStudio

前端 未结 7 2198
无人及你
无人及你 2020-12-01 18:30

I am implementing a solution to the Traveling Salesman Problem (TSP) in R (simulated Annealing) and I want to output the current best path periodically. I have searched qui

7条回答
  •  南笙
    南笙 (楼主)
    2020-12-01 18:51

    Calling Sys.sleep(0) should cause the plot to draw. Unlike the X11 solution, this will work on server versions of RStudio as well.

    (I was surprised that dev.flush() did not give the result you were hoping for, that might be a bug.)

提交回复
热议问题