Variation
'plot.box.and.whiskers' <- function( points.x = x, points.y = y, minimum.required = 6, black.and.white = black.and.white.in.panel ){ cat("\nPlotting Box and Whiskers\n") ### Box Plot Box Color (Default color is blue) box.rectangle <- trellis.par.get("box.rectangle") box.rectangle$col <- "black" trellis.par.set("box.rectangle", box.rectangle) ### Box Plot Outliers outlier.color <- "black" plot.symbol <- trellis.par.get("plot.symbol") plot.symbol$col <- outlier.color plot.symbol$cex <- 1 trellis.par.set("plot.symbol", plot.symbol) ### Box Plot Whiskers whisker.color <- "black" box.umbrella <- trellis.par.get("box.umbrella") box.umbrella$col <- whisker.color trellis.par.set("box.umbrella", box.umbrella) if(black.and.white){ boxfill.color <- "grey 90" }else{ boxfill.color <- "light yellow" } table.points.x <- table(points.x) locations.x <- table.points.x[table.points.x >= minimum.required] x.names <- as.numeric(names(locations.x)) if(length(x.names) > 0){ x.box.points <- points.x[points.x %in% x.names] y.box.points <- points.y[points.x %in% x.names] ### Select only locations that contained the minimum requirement #cat("Table of X.Points\n");print(table.points.x) #cat("X Points that Passed");print(x.names) #cat("x.box.points");print(x.box.points) #cat("y.box.points");print(y.box.points) panel.bwplot( x = x.box.points, y = y.box.points, horizontal = FALSE, color = "black", ### Color of "dot at median" pch="|", ### Creates a horizontal line at the median, instead of a solid dot. Omit if you like the 'dot' better. fill = boxfill.color ) }else{ cat("\nWarning!\n \tPlease lower the minimum required for the box and whisker plot to allow boxes to be plotted.\n \t(Only if desired)\n") } }
key = list( title = "Legend", text = list( c("Box and Whisker Outliers"), col="black" ), points = list( col = c("black"), pch = c(1), cex = c(1.5)*0.75 ), lines = list( col = c("black"), lwd = c(1)*0.75, lty = c("blank") ), type = "l", space = "right", cex.title = 1, cex = 0.75 )
'plot.violin' <- function( points.x = x, points.y = y, cut.off = 0, violin.color = "transparent", violin.ghost = .5 ){ cat("\nPlotting Violin Plot\n") ### Violin Color and Alpha (Default color is blue; Default alpha is 1) viol <- trellis.par.get("plot.polygon") viol$col <- violin.color viol$alpha <- violin.ghost trellis.par.set("plot.polygon", viol) panel.violin( x = points.x, y = points.y, horizontal = FALSE, cut=cut.off ) }
NA