diff --git a/Development/Create_the_MarkdownReports_Package.R b/Development/Create_the_MarkdownReports_Package.R index d6d9dcd..7f9377b 100644 --- a/Development/Create_the_MarkdownReports_Package.R +++ b/Development/Create_the_MarkdownReports_Package.R @@ -42,7 +42,7 @@ DESCRIPTION <- list("Title" = "Generate Scientific Figures and Reports Easily", 3. Link & display your figures automatically inside your report, right there where they are needed. 4. Version your findings, annotating which parameters were used to reach certain results. 5. Share your report with others via email, Github or a personal website.", "License" = "GNU GPL 3", - "Version"= "2.8", "Imports" = "vioplot, gplots, VennDiagram" + "Version"= "2.8.1", "Imports" = "vioplot, gplots, VennDiagram" ) setwd(RepositoryDir) diff --git a/MarkdownReports/R/MarkdownReports.R b/MarkdownReports/R/MarkdownReports.R index d054df4..380156f 100644 --- a/MarkdownReports/R/MarkdownReports.R +++ b/MarkdownReports/R/MarkdownReports.R @@ -488,20 +488,24 @@ wplot <-function (df_2columns, col = 1, pch = 18, ..., plotname = substitute(df_ -wscatter.fill <- function (x, y, ..., color, xlim=range(x), ylim=range(y), zlim=range(color), - nlevels = 20, pch=21, cex=1, - plotname = substitute(variable), plot.title = plotname, xlb = substitute(x), ylb = substitute(y), +wscatter.fill <- function (df2col = cbind("A"=rnorm(100), "B"=rnorm(100)), ..., color, xlim=range(df2col[,1]), ylim=range(df2col[,2]), zlim=range(color), nlevels = 20, pch=21, cex=1, + plotname = substitute(df2col), plot.title = plotname, plot.axes, key.title, key.axes, asp = NA, xaxs = "i", yaxs = "i", las = 1, - axes = TRUE, frame.plot = axes, + axes = TRUE, frame.plot = axes, xlb, ylb, savefile = T, w = 7, h = w, incrBottMarginBy = 0, mdlink = F ) { + x = df2col[,1] + y = df2col[,2] + CNN = colnames(df2col) + xlb = if(length(CNN) & missing(xlb)) CNN[1] + ylb = if(length(CNN) & missing(ylb)) CNN[2] fname = kollapse(plotname, ".barplot") if (incrBottMarginBy) { .ParMarDefault <- par("mar"); par(mar=c(par("mar")[1]+incrBottMarginBy, par("mar")[2:4]) ) } # Tune the margin mar.orig <- (par.orig <- par(c("mar", "las", "mfrow")))$mar on.exit(par(par.orig)) - w <- (3 + mar.orig[2L]) * par("csi") * 2.54 - layout(matrix(c(2, 1), ncol = 2L), widths = c(1, lcm(w))) + WID <- (3 + mar.orig[2L]) * par("csi") * 2.54 + layout(matrix(c(2, 1), ncol = 2L), widths = c(1, lcm(WID))) par(las = las) mar <- mar.orig mar[4L] <- mar[2L] @@ -526,8 +530,8 @@ wscatter.fill <- function (x, y, ..., color, xlim=range(x), ylim=range(y), zlim= par(mar = mar) # points - plot(x, y, main =plot.title, type = "n", xaxt='n', yaxt='n', ..., xlim=xlim, ylim=ylim, bty="n") - points(x, y, bg = colz, xaxt='n', yaxt='n', xlab="", ylab="", bty="n", pch=pch, ...) + plot(x, y, main =plot.title, type = "n", xaxt='n', yaxt='n', ..., xlim=xlim, ylim=ylim, bty="n", xlab=xlb, ylab=ylb) + points(x, y, bg = colz, xaxt='n', yaxt='n', xlab="", ylab="", bty="n", pch=pch,...) ## options to make mapping more customizable if (missing(plot.axes)) { diff --git a/MarkdownReports/R/MarkdownReports.R.bac b/MarkdownReports/R/MarkdownReports.R.bac index d054df4..380156f 100644 --- a/MarkdownReports/R/MarkdownReports.R.bac +++ b/MarkdownReports/R/MarkdownReports.R.bac @@ -488,20 +488,24 @@ wplot <-function (df_2columns, col = 1, pch = 18, ..., plotname = substitute(df_ -wscatter.fill <- function (x, y, ..., color, xlim=range(x), ylim=range(y), zlim=range(color), - nlevels = 20, pch=21, cex=1, - plotname = substitute(variable), plot.title = plotname, xlb = substitute(x), ylb = substitute(y), +wscatter.fill <- function (df2col = cbind("A"=rnorm(100), "B"=rnorm(100)), ..., color, xlim=range(df2col[,1]), ylim=range(df2col[,2]), zlim=range(color), nlevels = 20, pch=21, cex=1, + plotname = substitute(df2col), plot.title = plotname, plot.axes, key.title, key.axes, asp = NA, xaxs = "i", yaxs = "i", las = 1, - axes = TRUE, frame.plot = axes, + axes = TRUE, frame.plot = axes, xlb, ylb, savefile = T, w = 7, h = w, incrBottMarginBy = 0, mdlink = F ) { + x = df2col[,1] + y = df2col[,2] + CNN = colnames(df2col) + xlb = if(length(CNN) & missing(xlb)) CNN[1] + ylb = if(length(CNN) & missing(ylb)) CNN[2] fname = kollapse(plotname, ".barplot") if (incrBottMarginBy) { .ParMarDefault <- par("mar"); par(mar=c(par("mar")[1]+incrBottMarginBy, par("mar")[2:4]) ) } # Tune the margin mar.orig <- (par.orig <- par(c("mar", "las", "mfrow")))$mar on.exit(par(par.orig)) - w <- (3 + mar.orig[2L]) * par("csi") * 2.54 - layout(matrix(c(2, 1), ncol = 2L), widths = c(1, lcm(w))) + WID <- (3 + mar.orig[2L]) * par("csi") * 2.54 + layout(matrix(c(2, 1), ncol = 2L), widths = c(1, lcm(WID))) par(las = las) mar <- mar.orig mar[4L] <- mar[2L] @@ -526,8 +530,8 @@ wscatter.fill <- function (x, y, ..., color, xlim=range(x), ylim=range(y), zlim= par(mar = mar) # points - plot(x, y, main =plot.title, type = "n", xaxt='n', yaxt='n', ..., xlim=xlim, ylim=ylim, bty="n") - points(x, y, bg = colz, xaxt='n', yaxt='n', xlab="", ylab="", bty="n", pch=pch, ...) + plot(x, y, main =plot.title, type = "n", xaxt='n', yaxt='n', ..., xlim=xlim, ylim=ylim, bty="n", xlab=xlb, ylab=ylb) + points(x, y, bg = colz, xaxt='n', yaxt='n', xlab="", ylab="", bty="n", pch=pch,...) ## options to make mapping more customizable if (missing(plot.axes)) { diff --git a/MarkdownReports/man/wscatter.fill.Rd b/MarkdownReports/man/wscatter.fill.Rd index 01efa5d..f70aaa3 100644 --- a/MarkdownReports/man/wscatter.fill.Rd +++ b/MarkdownReports/man/wscatter.fill.Rd @@ -4,19 +4,15 @@ \alias{wscatter.fill} \title{wscatter.fill} \usage{ -wscatter.fill(x, y, ..., color, xlim = range(x), ylim = range(y), +wscatter.fill(df2col = cbind(A = rnorm(100), B = rnorm(100)), ..., color, + xlim = range(df2col[, 1]), ylim = range(df2col[, 2]), zlim = range(color), nlevels = 20, pch = 21, cex = 1, - plotname = substitute(variable), plot.title = plotname, - xlb = substitute(x), ylb = substitute(y), plot.axes, key.title, key.axes, - asp = NA, xaxs = "i", yaxs = "i", las = 1, axes = TRUE, - frame.plot = axes, savefile = T, w = 7, h = w, incrBottMarginBy = 0, - mdlink = F) + plotname = substitute(df2col), plot.title = plotname, plot.axes, + key.title, key.axes, asp = NA, xaxs = "i", yaxs = "i", las = 1, + axes = TRUE, frame.plot = axes, xlb, ylb, savefile = T, w = 7, + h = w, incrBottMarginBy = 0, mdlink = F) } \arguments{ -\item{x}{X variable} - -\item{y}{Y variable} - \item{...}{Pass any other parameter of the corresponding plotting function (most of them should work).} \item{color}{Filling color of the symbols} @@ -63,6 +59,10 @@ wscatter.fill(x, y, ..., color, xlim = range(x), ylim = range(y), \item{mdlink}{Insert a .pdf and a .png image link in the markdown report, set by "path_of_report".} +\item{x}{X variable} + +\item{y}{Y variable} + \item{ylimManually}{set the range of canvas in Y dimension} } \description{