Skip to content

Commit ba7d181

Browse files
committed
fixed minor bug
1 parent e45832b commit ba7d181

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

src/static/plot_stats_base.R

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -242,22 +242,26 @@ generate.static.plots.evol <- function(data, arcs, filtered)
242242
}
243243

244244
# generate barplots
245-
file <- get.path.stats.topo(mode=mode, char.det=char.det, net.type="static", meas.name=meas.name, weights=wmode, arc=if(arcs) TRUE else NA, vol=if(arcs) NA else TRUE, filtered=filt.txt, suf="evolution")
246-
tlog(4,"Generating file ",file)
247-
for(fformat in PLOT_FORMAT)
248-
{ if(fformat==PLOT_FORMAT_PDF)
249-
pdf(file=paste0(file,PLOT_FORMAT_PDF), bg="white")
250-
else if(fformat==PLOT_FORMAT_PNG)
251-
png(filename=paste0(file,PLOT_FORMAT_PNG), width=800, height=800, units="px", pointsize=20, bg="white")
252-
barplot(
253-
height=vals,
254-
names.arg=if(arcs) 1:length(items) else items,
255-
ylab=ALL_MEASURES[[meas.name]]$cname,
256-
xlab=if(arcs) "Narrative Arcs" else "Volumes",
257-
main=paste0("Evolution of ",ALL_MEASURES[[meas.name]]$cname," by ",if(arcs) "arc" else "volume"),
258-
col=col
259-
)
260-
dev.off()
245+
if(all(is.na(vals)))
246+
tlog(6,"WARNING: nothing to plot, all values are NAs")
247+
else
248+
{ file <- get.path.stats.topo(mode=mode, char.det=char.det, net.type="static", meas.name=meas.name, weights=wmode, arc=if(arcs) TRUE else NA, vol=if(arcs) NA else TRUE, filtered=filt.txt, suf="evolution")
249+
tlog(4,"Generating file ",file)
250+
for(fformat in PLOT_FORMAT)
251+
{ if(fformat==PLOT_FORMAT_PDF)
252+
pdf(file=paste0(file,PLOT_FORMAT_PDF), bg="white")
253+
else if(fformat==PLOT_FORMAT_PNG)
254+
png(filename=paste0(file,PLOT_FORMAT_PNG), width=800, height=800, units="px", pointsize=20, bg="white")
255+
barplot(
256+
height=vals,
257+
names.arg=if(arcs) 1:length(items) else items,
258+
ylab=ALL_MEASURES[[meas.name]]$cname,
259+
xlab=if(arcs) "Narrative Arcs" else "Volumes",
260+
main=paste0("Evolution of ",ALL_MEASURES[[meas.name]]$cname," by ",if(arcs) "arc" else "volume"),
261+
col=col
262+
)
263+
dev.off()
264+
}
261265
}
262266
}
263267
}

0 commit comments

Comments
 (0)