@@ -274,13 +274,14 @@ reconstruct_pattern_homo <- function(pattern,
274
274
if (plot ) {
275
275
276
276
# https://support.rstudio.com/hc/en-us/community/posts/200661917-Graph-does-not-update-until-loop-completion
277
- Sys.sleep(0.1 )
277
+ Sys.sleep(0.01 )
278
278
279
279
graphics :: plot(x = pcf_observed [[1 ]], y = pcf_observed [[3 ]],
280
280
type = " l" , col = " black" ,
281
281
xlab = " r" , ylab = " g(r)" )
282
282
283
- graphics :: lines(x = pcf_relocated [[1 ]], y = pcf_relocated [[3 ]], col = " red" )
283
+ graphics :: lines(x = pcf_relocated [[1 ]], y = pcf_relocated [[3 ]],
284
+ col = " red" )
284
285
285
286
graphics :: legend(" topright" ,
286
287
legend = c(" observed" , " reconstructed" ),
@@ -303,8 +304,12 @@ reconstruct_pattern_homo <- function(pattern,
303
304
# print progress
304
305
if (verbose ) {
305
306
307
+ if (! plot ) {
308
+ Sys.sleep(0.01 )
309
+ }
310
+
306
311
message(" \r > Progress: n_random: " , current_pattern , " /" , n_random ,
307
- " || max_runs: " , i , " / " , max_runs ,
312
+ " || max_runs: " , floor( i / max_runs * 100 ), " % " ,
308
313
" || energy = " , round(energy_current , 5 ), " \t\t " ,
309
314
appendLF = FALSE )
310
315
}
0 commit comments