R/plotNumberOfRounds.R

#' plotNumberOfRounds
#' Plots the mean number of rounds it took for the status quo to be defeated for each k-majority rule, across all the iterations.
#' 
#' @param outputDataList The output data list of summaries, that is generated by the iterations() function
#' @return A plot of the mean, across all iterations, that a proposal passed for each k-majority rule.
#'  @export
plotNumberOfRounds<- function(outputDataList){
  numberOfKMajorities <- nrow(outputDataList$rounds)
  xRange <- range(c(0:numberOfKMajorities))
  yRange <- range(c(0:max(outputDataList$rounds$meanRoundProposalPassedEachIteration)))
  plot(xRange, yRange, type="n", xlab="k-majority", ylab="Mean Number of Rounds SQ Prevailed")
  lines(c(1:numberOfKMajorities), outputDataList$rounds$meanRoundProposalPassedEachIteration, col = "Black", lwd = 2, lty = "solid")
  legend(1,max(outputDataList$rounds$meanRoundProposalPassedEachIteration), # places a legend at the appropriate place 
         c("Mean Rounds", "Min-Max Rounds Interval"), # puts text in the legend 
         lty=c("solid", "dotted"), # gives the legend appropriate symbols (lines)
         lwd=c(3,3),col=c("Black","Black")) # gives the legend lines the correct color and width
}
codeForReviewer/kMajorityRule documentation built on May 13, 2019, 8:47 p.m.