Skip to content

Commit

Permalink
Plots with a double dash (--) in the names (#1183) (#1212)
Browse files Browse the repository at this point in the history
* Plots with a double dash (--) in the names (#1183)

#1183

* Plots with a double dash (--) in the names (#1183) 

remove "Default"

* Plots with a double dash (--) in the names (#1183) 

fix assignment operations

* Plots with a double dash (--) in the names (#1183) 

replace assignments operator

* Plots with a double dash (--) in the names (#1183)

#1212
  • Loading branch information
marcnet80 authored and AndreyAkinshin committed Aug 3, 2019
1 parent 9caa055 commit 5d7c789
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/BenchmarkDotNet/Templates/BuildPlots.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ library(tidyr)
library(grid)
library(gridExtra)

isEmpty <- function(val){
is.null(val) | val == ""
}

createPrefix <- function(params){
separator <- "-"
values <- params[!isEmpty(params)]
paste(replace(values, TRUE, paste0(separator, values)), collapse = "")
}

ends_with <- function(vars, match, ignore.case = TRUE) {
if (ignore.case)
match <- tolower(match)
Expand Down Expand Up @@ -103,17 +113,17 @@ for (file in files) {

for (params in unique(df$Params)) {
paramsDf <- df %>% filter(Params == params)

paramsDensityPlot <- ggplot(paramsDf, aes(x=Measurement_Value, fill=Job_Id)) +
ggtitle(paste(title, "/", target, "/", params)) +
xlab(paste("Time,", timeUnit)) +
geom_density(alpha=.5, bw="SJ")
printNice(paramsDensityPlot)
ggsaveNice(gsub("-measurements.csv", paste0("-", target, "-", params, "-density.png"), file), paramsDensityPlot)
prefix <- createPrefix(c(target,params))
ggsaveNice(gsub("-measurements.csv", paste0(prefix, "-density.png"), file), paramsDensityPlot)

paramsFacetDensityPlot <- paramsDensityPlot + facet_wrap(~Job_Id)
printNice(paramsFacetDensityPlot)
ggsaveNice(gsub("-measurements.csv", paste0("-", target, "-", params, "-facetDensity.png"), file), paramsFacetDensityPlot)
ggsaveNice(gsub("-measurements.csv", paste0(prefix, "-facetDensity.png"), file), paramsFacetDensityPlot)
}

for (job in unique(df$Job_Id)) {
Expand Down

0 comments on commit 5d7c789

Please sign in to comment.