diff --git a/DESCRIPTION b/DESCRIPTION index a53d306..bb057c1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ -Package: ggupset +Package: ggupsetJAK Type: Package Title: Combination Matrix Axis for 'ggplot2' to Create 'UpSet' Plots -Version: 0.3.0 +Version: 0.3.4 URL: https://github.com/const-ae/ggupset BugReports: https://github.com/const-ae/ggupset/issues Authors@R: person("Constantin", "Ahlmann-Eltze", email = "artjom31415@googlemail.com", @@ -15,7 +15,7 @@ Description: Replace the standard x-axis in 'ggplots' with a combination matrix License: GPL-3 Encoding: UTF-8 LazyData: true -RoxygenNote: 7.0.2 +RoxygenNote: 7.1.1 Depends: R (>= 2.10) Suggests: diff --git a/R/axis_combmatrix.R b/R/axis_combmatrix.R index d436685..27e7ce3 100644 --- a/R/axis_combmatrix.R +++ b/R/axis_combmatrix.R @@ -252,18 +252,21 @@ make_combination_matrix_plot <- function(labels, labels_split, label_set, range, plt <- ggplot(df2, aes(x= .data$at, y= .data$single_label)) if(isTRUE(theme$combmatrix.panel.striped_background)){ - plt <- plt + geom_rect(aes(fill= .data$index %% 2 == 0), ymin=df2$index-0.5, ymax=df2$index+0.5, xmin=0, xmax=1) + plt <- plt + + geom_rect(aes(fill= .data$index %% 2 == 0), ymin=df2$index-0.5, ymax=df2$index+0.5, xmin=0, xmax=1) } plt <- plt + geom_point(aes(color= .data$observed), size=theme$combmatrix.panel.point.size) + if (!isTRUE(theme$combmatrix.panel.line.size == 0)) { # If combmatrix.panel.line.size is not a single number equal to 0, add the # lines. (ifFALSE is available starting in v3.5) plt <- plt + geom_line( data=function(dat) dat[dat$observed, ,drop=FALSE], aes(group = .data$labels), - size=theme$combmatrix.panel.line.size + size=theme$combmatrix.panel.line.size, + color=theme$combmatrix.panel.line.color ) } plt + @@ -276,7 +279,11 @@ make_combination_matrix_plot <- function(labels, labels_split, label_set, range, `FALSE` = theme$combmatrix.panel.point.color.empty)) + guides(color="none", fill="none") + theme( + rect = element_rect(fill = 'transparent', color = 'transparent'), + plot.background = element_rect(fill = 'transparent', color = 'transparent'), panel.background = element_blank(), + panel.grid.major = element_blank(), + panel.grid.minor = element_blank(), axis.text.y = theme$combmatrix.label.text %||% theme$axis.text.y, axis.text.x = element_blank(), axis.ticks.y = element_blank(), diff --git a/R/theme_combmatrix.R b/R/theme_combmatrix.R index 1ffbf47..d846da9 100644 --- a/R/theme_combmatrix.R +++ b/R/theme_combmatrix.R @@ -33,6 +33,8 @@ #' in the combination matrix. Default: 3 #' @param combmatrix.panel.line.size Number to specify the size of the lines #' connecting the points. Default: 1.2 +#' @param combmatrix.panel.line.color Color of the lines connecting the points. +#' Default: "black" #' @param combmatrix.panel.point.color.fill Color of the filled points. #' Default: "black" #' @param combmatrix.panel.point.color.empty Color of the empty points. @@ -72,6 +74,7 @@ theme_combmatrix <- function( combmatrix.panel.striped_background.color.two = "#F7F7F7", combmatrix.panel.point.size = 3, combmatrix.panel.line.size = 1.2, + combmatrix.panel.line.color = "black", combmatrix.panel.point.color.fill = "black", combmatrix.panel.point.color.empty = "#E0E0E0", ... @@ -89,6 +92,7 @@ theme_combmatrix <- function( combmatrix.panel.striped_background.color.two = combmatrix.panel.striped_background.color.two, combmatrix.panel.point.size = combmatrix.panel.point.size, combmatrix.panel.line.size = combmatrix.panel.line.size, + combmatrix.panel.line.color = combmatrix.panel.line.color, combmatrix.panel.point.color.fill = combmatrix.panel.point.color.fill, combmatrix.panel.point.color.empty = combmatrix.panel.point.color.empty, ..., diff --git a/man/df_complex_conditions.Rd b/man/df_complex_conditions.Rd index fbe28e3..d0cf872 100644 --- a/man/df_complex_conditions.Rd +++ b/man/df_complex_conditions.Rd @@ -4,7 +4,8 @@ \name{df_complex_conditions} \alias{df_complex_conditions} \title{A fictional biological dataset with a complex experimental design} -\format{a data frame with 360 rows and 4 variables +\format{ +a data frame with 360 rows and 4 variables \itemize{ \item KO. Boolean value if the sample had a knock out. \item DrugA. character vector with "Yes" and "No" elements @@ -15,7 +16,8 @@ \item response. Numeric vector with the response of the sample to the treatment conditions. Could for example be the concentration of a metabolite. -}} +} +} \usage{ df_complex_conditions } diff --git a/man/gene_pathway_membership.Rd b/man/gene_pathway_membership.Rd index eddebd5..cd3b9d1 100644 --- a/man/gene_pathway_membership.Rd +++ b/man/gene_pathway_membership.Rd @@ -4,9 +4,11 @@ \name{gene_pathway_membership} \alias{gene_pathway_membership} \title{A fictional dataset describing which genes belong to certain pathways} -\format{a matrix with 6 rows and 37 columns. Each row is one pathway, with +\format{ +a matrix with 6 rows and 37 columns. Each row is one pathway, with its name given as `rownames` and each column is a gene. The values - in the matrix are Boolean indicators if the gene is a member of the pathway.} + in the matrix are Boolean indicators if the gene is a member of the pathway. +} \usage{ gene_pathway_membership } diff --git a/man/theme_combmatrix.Rd b/man/theme_combmatrix.Rd index da2ba1e..96be350 100644 --- a/man/theme_combmatrix.Rd +++ b/man/theme_combmatrix.Rd @@ -17,6 +17,7 @@ theme_combmatrix( combmatrix.panel.striped_background.color.two = "#F7F7F7", combmatrix.panel.point.size = 3, combmatrix.panel.line.size = 1.2, + combmatrix.panel.line.color = "black", combmatrix.panel.point.color.fill = "black", combmatrix.panel.point.color.empty = "#E0E0E0", ... @@ -65,6 +66,9 @@ in the combination matrix. Default: 3} \item{combmatrix.panel.line.size}{Number to specify the size of the lines connecting the points. Default: 1.2} +\item{combmatrix.panel.line.color}{Color of the lines connecting the points. +Default: "black"} + \item{combmatrix.panel.point.color.fill}{Color of the filled points. Default: "black"} diff --git a/man/tidy_movies.Rd b/man/tidy_movies.Rd index 3995830..4615d99 100644 --- a/man/tidy_movies.Rd +++ b/man/tidy_movies.Rd @@ -4,7 +4,8 @@ \name{tidy_movies} \alias{tidy_movies} \title{Tidy version of the movies dataset from the ggplot2 package} -\format{a data frame with 50,000 rows and 10 columns +\format{ +a data frame with 50,000 rows and 10 columns \itemize{ \item title. The title of the movie. \item year. Year of release. @@ -16,7 +17,8 @@ \item Genres. List column with all genres the movie belongs to \item stars, percent_rating. The number of stars and the corresponding percentage of people rating the movie with this many stars. -}} +} +} \usage{ tidy_movies }