@@ -297,7 +297,7 @@ generate.static.plots.single <- function(mode, window.sizes, overlaps)
297297 names(values ) <- nms
298298
299299 # generate the boxplot plot
300- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , window.size = window.size , suf = " boxplot" )
300+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , window.size = window.size , suf = " boxplot" )
301301 tlog(5 ," Plotting file \" " ,plot.file ," \" " )
302302 for (fformat in PLOT_FORMAT )
303303 { if (fformat == PLOT_FORMAT_PDF )
@@ -322,7 +322,7 @@ generate.static.plots.single <- function(mode, window.sizes, overlaps)
322322 }
323323
324324 # generate the violin plot
325- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , window.size = window.size , suf = " violin" )
325+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , window.size = window.size , suf = " violin" )
326326 tlog(5 ," Plotting file \" " ,plot.file ," \" " )
327327 for (fformat in PLOT_FORMAT )
328328 { if (fformat == PLOT_FORMAT_PDF )
@@ -347,7 +347,7 @@ generate.static.plots.single <- function(mode, window.sizes, overlaps)
347347 }
348348
349349 # generate distribution plots
350- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , window.size = window.size , suf = " distrib" )
350+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , window.size = window.size , suf = " distrib" )
351351 tlog(5 ," Plotting file \" " ,plot.file ," \" " )
352352 cols <- c(" BLACK" , " BLACK" , viridis(length(values )- 2 ))
353353 lty <- c(2 , 3 , rep(1 ,length(values )- 1 ))
@@ -391,7 +391,7 @@ generate.static.plots.single <- function(mode, window.sizes, overlaps)
391391 names(values ) <- nms
392392
393393 # generate the boxplot
394- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , overlap = overlap , suf = " boxplot" )
394+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , overlap = overlap , suf = " boxplot" )
395395 tlog(5 ," Plotting file \" " ,plot.file ," \" " )
396396 for (fformat in PLOT_FORMAT )
397397 { if (fformat == PLOT_FORMAT_PDF )
@@ -416,7 +416,7 @@ generate.static.plots.single <- function(mode, window.sizes, overlaps)
416416 }
417417
418418 # generate the violin plot
419- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , overlap = overlap , suf = " violin" )
419+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , overlap = overlap , suf = " violin" )
420420 tlog(5 ," Plotting file \" " ,plot.file ," \" " )
421421 for (fformat in PLOT_FORMAT )
422422 { if (fformat == PLOT_FORMAT_PDF )
@@ -436,7 +436,7 @@ generate.static.plots.single <- function(mode, window.sizes, overlaps)
436436 }
437437
438438 # generate distribution plots
439- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , overlap = overlap , suf = " distrib" )
439+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , overlap = overlap , suf = " distrib" )
440440 tlog(5 ," Plotting file \" " ,plot.file ," \" " )
441441 cols <- c(" BLACK" , " BLACK" , viridis(length(values )- 2 ))
442442 lty <- c(2 , 3 , rep(1 ,length(values )- 1 ))
@@ -517,7 +517,7 @@ generate.static.plots.multiple <- function(mode, window.sizes, overlaps)
517517 # generate a plot containing each window size value as a series
518518 # cols <- get.palette(length(data))
519519 cols <- viridis(length(data ))
520- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , window.size = " " , suf = " series" )
520+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , window.size = " " , suf = " series" )
521521 tlog(5 ," Plotting file \" " ,plot.file ," \" " )
522522 if (all(is.na(unlist(data ))))
523523 { msg <- paste0(" WARNING: All values are NA for " , plot.file )
@@ -587,7 +587,7 @@ generate.static.plots.multiple <- function(mode, window.sizes, overlaps)
587587 # generate a plot representing each overlap value as a series
588588 # cols <- get.palette(length(data))
589589 cols <- viridis(length(data ))
590- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , overlap = " " , suf = " series" )
590+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , overlap = " " , suf = " series" )
591591 tlog(5 ," Plotting file \" " ,plot.file ," \" " )
592592 if (all(is.na(unlist(data ))))
593593 { msg <- paste0(" WARNING: All values are NA for " , plot.file )
@@ -687,7 +687,7 @@ generate.static.plots.corr <- function(mode, window.sizes, overlaps)
687687 }
688688 # generate a plot containing each window size value as a series
689689 cols <- get.palette(length(data ))
690- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , window.size = " " , suf = " corr" )
690+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , window.size = " " , suf = " corr" )
691691 tlog(5 ," Plotting file \" " ,plot.file ," \" " )
692692 if (all(is.na(unlist(data ))))
693693 { msg <- paste0(" WARNING: All values are NA for " , plot.file )
@@ -748,7 +748,7 @@ generate.static.plots.corr <- function(mode, window.sizes, overlaps)
748748 }
749749 # generate a plot representing each overlap value as a series
750750 cols <- get.palette(length(data ))
751- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , overlap = " " , suf = " corr" )
751+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , overlap = " " , suf = " corr" )
752752 tlog(5 ," Plotting file \" " ,plot.file ," \" " )
753753 if (all(is.na(unlist(data ))))
754754 { msg <- paste0(" WARNING: All values are NA for " , plot.file )
@@ -804,7 +804,7 @@ generate.static.plots.corr <- function(mode, window.sizes, overlaps)
804804
805805# ############################################################################################
806806# Generates a bar plot comparing two node or node-pair measures. The reference measure is used as
807- # a baseline, and to order the nodes on the x axis. The comparison measure is used to process
807+ # a baseline, and to order the nodes on the x- axis. The comparison measure is used to process
808808# the ranking difference with the reference measure, and the result appears as the bar heights.
809809#
810810# mode: either "panel.window" or "page.window" (not "scenes").
@@ -865,7 +865,7 @@ generate.static.plots.ranks <- function(mode, window.sizes, overlaps)
865865 colors <- heat.colors(max(ranks ))
866866
867867 # generate the plot
868- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , window.size = window.size , overlap = overlap , suf = paste0(" ranks=" ,substr(weights ,1 ,3 )))
868+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , window.size = window.size , overlap = overlap , suf = paste0(" ranks=" ,substr(weights ,1 ,3 )))
869869 tlog(5 ," Plotting file \" " ,plot.file ," \" " )
870870 for (fformat in PLOT_FORMAT )
871871 { if (fformat == PLOT_FORMAT_PDF )
@@ -960,7 +960,7 @@ generate.static.plots.tfpn <- function(mode, window.sizes=NA, overlaps=NA)
960960 ylab <- " Frequency"
961961 }
962962
963- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , window.size = window.size , suf = paste0(md ," _barplot" ))
963+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , window.size = window.size , suf = paste0(md ," _barplot" ))
964964 for (fformat in PLOT_FORMAT )
965965 { if (fformat == PLOT_FORMAT_PDF )
966966 pdf(file = paste0(plot.file ,PLOT_FORMAT_PDF ), bg = " white" )
@@ -1007,7 +1007,7 @@ generate.static.plots.tfpn <- function(mode, window.sizes=NA, overlaps=NA)
10071007 ylab <- " Frequency"
10081008 }
10091009
1010- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , overlap = overlap , suf = paste0(md ," _barplot" ))
1010+ plot.file <- get.path.stats.comp(mode = mode , meas.name = meas.name , overlap = overlap , suf = paste0(md ," _barplot" ))
10111011 for (fformat in PLOT_FORMAT )
10121012 { if (fformat == PLOT_FORMAT_PDF )
10131013 pdf(file = paste0(plot.file ,PLOT_FORMAT_PDF ), bg = " white" )
@@ -1071,11 +1071,16 @@ generate.static.plots.all <- function(mode, window.sizes, overlaps)
10711071# filtered: whether to use the filtered version of the graph.
10721072# ##############################################################################
10731073generate.static.plots.scene <- function (arc = NA , vol = NA , filtered = FALSE )
1074- { filt.txt <- if (filtered ) " filtered" else " unfiltered"
1074+ { if (filtered )
1075+ { col <- ATT_COLORS_FILT [" Keep" ]
1076+ filt.txt <- " filtered"
1077+ }
1078+ else
1079+ { col <- ATT_COLORS_FILT [" Discard" ]
1080+ filt.txt <- " unfiltered"
1081+ }
10751082 tlog(3 ," Generating plots for the " ,filt.txt ," scene-based graphs" )
10761083 mode <- " scenes"
1077- wmodes <- c(" occurrences" ," duration" )
1078- col <- ATT_COLORS_FILT [if (filtered ) " Keep" else " Discard" ]
10791084
10801085 # list measures to plot
10811086 nmn <- names(NODE_MEASURES )
@@ -1093,6 +1098,11 @@ generate.static.plots.scene <- function(arc=NA, vol=NA, filtered=FALSE)
10931098 else if (meas.name %in% npmn )
10941099 object <- " nodepairs"
10951100
1101+ if (ALL_MEASURES [[meas.name ]]$ weighted )
1102+ wmodes <- c(" occurrences" ," duration" )
1103+ else
1104+ wmodes <- c(" none" )
1105+
10961106 # process each type of weight
10971107 for (wmode in wmodes )
10981108 { tlog(4 ," Dealing with weights=" ,wmode )
@@ -1104,8 +1114,7 @@ generate.static.plots.scene <- function(arc=NA, vol=NA, filtered=FALSE)
11041114 # vals <- vals[vals>0] # remove the zeroes?
11051115
11061116 # plot histogram
1107- plot.file <- get.path.stats.comp(object = object , mode = mode , meas.name = meas.name , weights = wmode , arc = arc , vol = vol , filtered = filtered , suf = " histo" )
1108- # TODO why is this the "comparison" folder? shouldn't it be stats or plots?
1117+ plot.file <- get.path.stats.topo(mode = mode , net.type = " static" , meas.name = meas.name , weights = wmode , arc = arc , vol = vol , filtered = filt.txt , suf = " histo" )
11091118 for (fformat in PLOT_FORMAT )
11101119 { if (fformat == PLOT_FORMAT_PDF )
11111120 pdf(file = paste0(plot.file ,PLOT_FORMAT_PDF ), bg = " white" )
@@ -1126,19 +1135,19 @@ generate.static.plots.scene <- function(arc=NA, vol=NA, filtered=FALSE)
11261135 }
11271136
11281137 # plot complementary cumulative distribution function
1129- plot.file <- get.path.stats.comp( object = object , mode = mode , meas.name = meas.name , weights = wmode , arc = arc , vol = vol , filtered = filtered , suf = " ccdf" )
1138+ plot.file <- get.path.stats.topo( mode = mode , net.type = " static " , meas.name = meas.name , weights = wmode , arc = arc , vol = vol , filtered = filt.txt , suf = " ccdf" )
11301139 for (fformat in PLOT_FORMAT )
11311140 { if (fformat == PLOT_FORMAT_PDF )
11321141 pdf(file = paste0(plot.file ,PLOT_FORMAT_PDF ), bg = " white" )
11331142 else if (fformat == PLOT_FORMAT_PNG )
11341143 png(filename = paste0(plot.file ,PLOT_FORMAT_PNG ), width = 800 , height = 800 , units = " px" , pointsize = 20 , bg = " white" )
1135- plot.ccdf(data = vals , main = ml , xlab = xl , ylab = " default" , log = TRUE )
1144+ plot.ccdf(data = vals , main = ml , xlab = xl , ylab = " default" , cols = col , log = TRUE )
11361145 dev.off()
11371146 }
11381147
11391148 # test the type of distribution (very slow, doing it only for the whole graph)
11401149 if (is.na(arc ) && is.na(vol ))
1141- { plot.file <- get.path.stats.comp( object = object , mode = mode , meas.name = meas.name , weights = wmode , arc = arc , vol = vol , filtered = filtered , suf = " disttest " )
1150+ { plot.file <- get.path.stats.topo( mode = mode , net.type = " static " , meas.name = meas.name , weights = wmode , arc = arc , vol = vol , filtered = filt.txt , suf = " distrtest " )
11421151 if (all(vals %% 1 == 0 ))
11431152 test.disc.distr(data = vals , xlab = ALL_MEASURES [[meas.name ]]$ cname , return_stats = TRUE , sims = 100 , plot.file = plot.file )
11441153 else
@@ -1157,32 +1166,32 @@ generate.static.plots.scene <- function(arc=NA, vol=NA, filtered=FALSE)
11571166 g.occ <- g ; E(g.occ )$ weight <- E(g )$ Occurrences
11581167
11591168 # degree vs. neighbors' degree
1160- filename <- get.path.stats.comp( object = " nodes " , mode = " scenes " , meas.name = MEAS_DEGREE , arc = arc , vol = vol , filtered = filtered )
1169+ filename <- get.path.stats.topo( mode = mode , net.type = " static " , meas.name = MEAS_DEGREE , weights = wmode , arc = arc , vol = vol , filtered = filt.txt , suf = " nei.deg_vs_degree " )
11611170 neigh.degree.vs.degree(g , weights = FALSE , filename , col )
1162- for (wmode in wmodes )
1163- { filename <- get.path.stats.comp( object = " nodes " , mode = " scenes " , meas.name = " strength " , weights = wmode , arc = arc , vol = vol , filtered = filtered )
1171+ for (wmode in c( " occurrences " , " duration " ) )
1172+ { filename <- get.path.stats.topo( mode = mode , net.type = " static " , meas.name = MEAS_STRENGTH , weights = wmode , arc = arc , vol = vol , filtered = filt.txt , suf = " nei.str_vs_strength " )
11641173 if (wmode == " duration" )
11651174 neigh.degree.vs.degree(g.dur , weights = TRUE , filename , col )
11661175 else if (wmode == " occurrences" )
11671176 neigh.degree.vs.degree(g.occ , weights = TRUE , filename , col )
11681177 }
11691178
11701179 # degree vs. transitivity
1171- filename <- get.path.stats.comp( object = " nodes " , mode = " scenes " , meas.name = MEAS_DEGREE , arc = arc , vol = vol , filtered = filtered )
1180+ filename <- get.path.stats.topo( mode = mode , net.type = " static " , meas.name = MEAS_MULTI_NODES , weights = wmode , arc = arc , vol = vol , filtered = filt.txt , suf = " transitivity_vs_degree " )
11721181 transitivity.vs.degree(g , weights = FALSE , filename , col )
1173- for (wmode in wmodes )
1174- { filename <- get.path.stats.comp( object = " nodes " , mode = " scenes " , meas.name = " strength " , weights = wmode , arc = arc , vol = vol , filtered = filtered )
1182+ for (wmode in c( " occurrences " , " duration " ) )
1183+ { filename <- get.path.stats.topo( mode = mode , net.type = " static " , meas.name = MEAS_MULTI_NODES , weights = wmode , arc = arc , vol = vol , filtered = filt.txt , suf = " transitivity_vs_strength " )
11751184 if (wmode == " duration" )
11761185 transitivity.vs.degree(g.dur , weights = TRUE , filename , col )
11771186 else if (wmode == " occurrences" )
11781187 transitivity.vs.degree(g.occ , weights = TRUE , filename , col )
11791188 }
11801189
11811190 # hop plots
1182- filename <- get.path.stats.comp( object = " nodepairs " , mode = " scenes " , meas.name = MEAS_DISTANCE , arc = arc , vol = vol , filtered = filtered )
1191+ filename <- get.path.stats.topo( mode = mode , net.type = " static " , meas.name = MEAS_DISTANCE , weights = wmode , arc = arc , vol = vol , filtered = filt.txt , suf = " hop-plot " )
11831192 hop.plot(g , weights = FALSE , filename , col )
1184- for (wmode in wmodes )
1185- { filename <- get.path.stats.comp( object = " nodepairs " , mode = " scenes " , meas.name = " distance " , weights = wmode , arc = arc , vol = vol , filtered = filtered )
1193+ for (wmode in c( " occurrences " , " duration " ) )
1194+ { filename <- get.path.stats.topo( mode = mode , net.type = " static " , meas.name = MEAS_DISTANCE , weights = wmode , arc = arc , vol = vol , filtered = filt.txt , suf = " hop-plot " )
11861195 if (wmode == " duration" )
11871196 hop.plot(g.dur , weights = TRUE , filename , col )
11881197 else if (wmode == " occurrences" )
@@ -1209,13 +1218,12 @@ generate.static.plots.evol <- function(data, arcs, filtered)
12091218 }
12101219 else
12111220 { emode <- " volume"
1212- items <- data $ volume.stats [,COL_VOLUME ]
1221+ items <- paste( 1 : nrow( data $ volume.stats ), " _ " , data $ volume.stats [,COL_VOLUME ], sep = " " )
12131222 }
12141223
12151224 # init other variables
12161225 tlog(3 ," Generating " ,emode ," -based evolution plots for the " ,filt.txt ," scene-based graphs" )
12171226 mode <- " scenes"
1218- wmodes <- c(" occurrences" ," duration" )
12191227 col <- ATT_COLORS_FILT [if (filtered ) " Keep" else " Discard" ]
12201228
12211229 # list measures to plot
@@ -1226,6 +1234,11 @@ generate.static.plots.evol <- function(data, arcs, filtered)
12261234 { tlog(4 ," Generating " ,emode ," -based evolution plots for measure " ,meas.name )
12271235 object <- " graph"
12281236
1237+ if (ALL_MEASURES [[meas.name ]]$ weighted )
1238+ wmodes <- c(" occurrences" ," duration" )
1239+ else
1240+ wmodes <- c(" none" )
1241+
12291242 # process each type of weight
12301243 for (wmode in wmodes )
12311244 { tlog(4 ," Dealing with weights=" ,wmode )
0 commit comments