Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ Imports:
stats,
methods,
grDevices,
scales
scales,
grid
License: MIT + file LICENSE
LazyData: true
VignetteBuilder: knitr
Suggests:
knitr
RoxygenNote: 5.0.1
RoxygenNote: 6.0.1
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import(stats)
import(utils)
importFrom(grid,gpar)
importFrom(grid,grid.draw)
importFrom(grid,grid.grab)
importFrom(grid,grid.layout)
importFrom(grid,grid.newpage)
importFrom(grid,legendGrob)
Expand Down
34 changes: 17 additions & 17 deletions R/UpSet.plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ BaseBoxPlot <- function(box_plot, position, size_plot_height, Main_bar_plot, Mat
}
vp = vplayout(bar_top:matrix_bottom, matrix_and_mainbar_left:matrix_and_mainbar_right)
pushViewport(vp)
grid.draw(arrangeGrob(Main_bar_plot, Matrix_plot, heights = hratios))
grid.draw(arrangeGrob(Main_bar_plot, Matrix_plot, heights = hratios, name = "main"))
popViewport()
vp = vplayout(size_plot_height:matrix_bottom, size_bar_left:size_bar_right)
pushViewport(vp)
grid.draw(arrangeGrob(Size_plot))
grid.draw(arrangeGrob(Size_plot, name = "size"))
popViewport()
if(is.null(set_metadata) == F){
for(i in 1:length(set_metadata_plots)){
Expand All @@ -136,18 +136,18 @@ BaseBoxPlot <- function(box_plot, position, size_plot_height, Main_bar_plot, Mat

vp = vplayout(size_plot_height:matrix_bottom, metadata_left:metadata_right)
pushViewport(vp)
grid.draw(arrangeGrob(set_metadata_plots[[i]]))
grid.draw(arrangeGrob(set_metadata_plots[[i]], name = "metadata"))
popViewport()
}
}
vp = vplayout(att_top:att_bottom, matrix_and_mainbar_left:matrix_and_mainbar_right)
pushViewport(vp)
grid.draw(arrangeGrob(box_plot[[1]]))
grid.draw(arrangeGrob(box_plot[[1]], name = "boxplot1"))
popViewport()
if(length(box_plot) == 2){
vp = vplayout((att_bottom + 10):(att_bottom + 25), matrix_and_mainbar_left:matrix_and_mainbar_right)
pushViewport(vp)
grid.draw(arrangeGrob(box_plot[[2]]))
grid.draw(arrangeGrob(box_plot[[2]], name = "boxplot2"))
popViewport()
}
}
Expand Down Expand Up @@ -198,11 +198,11 @@ NoAttBasePlot <- function(legend, size_plot_height, Main_bar_plot, Matrix_plot,
}
vp = vplayout(top:bottom, matrix_and_mainbar_left:matrix_and_mainbar_right)
pushViewport(vp)
grid.draw(arrangeGrob(Main_bar_plot, Matrix_plot, heights = hratios))
grid.draw(arrangeGrob(Main_bar_plot, Matrix_plot, heights = hratios, name = "main"))
popViewport()
vp = vplayout(size_plot_height:bottom, size_bar_left:size_bar_right)
pushViewport(vp)
grid.draw(arrangeGrob(Size_plot))
grid.draw(arrangeGrob(Size_plot, name = "size"))
popViewport()
if(is.null(set_metadata) == F){
for(i in 1:length(set_metadata_plots)){
Expand All @@ -217,14 +217,14 @@ NoAttBasePlot <- function(legend, size_plot_height, Main_bar_plot, Matrix_plot,

vp = vplayout(size_plot_height:bottom, metadata_left:metadata_right)
pushViewport(vp)
grid.draw(arrangeGrob(set_metadata_plots[[i]]))
grid.draw(arrangeGrob(set_metadata_plots[[i]], name = "metadata"))
popViewport()
}
}
if((is.null(legend) == F) && (query_legend != tolower("none"))){
vp = vplayout(legend_top:legend_bottom, matrix_and_mainbar_left:matrix_and_mainbar_right)
pushViewport(vp)
grid.draw(arrangeGrob(legend))
grid.draw(arrangeGrob(legend, name = "legend"))
popViewport()
}
}
Expand Down Expand Up @@ -263,11 +263,11 @@ BaseCustomPlot <- function(attribute_plots, plots, position, size_plot_height, M
pushViewport(viewport(layout = grid.layout(custom_bottom,matrix_and_mainbar_right)))
vp = vplayout(bar_top:matrix_bottom, matrix_and_mainbar_left:matrix_and_mainbar_right)
pushViewport(vp)
grid.draw(arrangeGrob(Main_bar_plot, Matrix_plot, heights = hratios))
grid.draw(arrangeGrob(Main_bar_plot, Matrix_plot, heights = hratios, name = "main"))
popViewport()
vp = vplayout(size_plot_height:matrix_bottom, size_bar_left:size_bar_right)
pushViewport(vp)
grid.draw(arrangeGrob(Size_plot))
grid.draw(arrangeGrob(Size_plot, name = "size"))
popViewport()
if(is.null(set_metadata) == F){
for(i in 1:length(set_metadata_plots)){
Expand All @@ -282,34 +282,34 @@ BaseCustomPlot <- function(attribute_plots, plots, position, size_plot_height, M

vp = vplayout(size_plot_height:matrix_bottom, metadata_left:metadata_right)
pushViewport(vp)
grid.draw(arrangeGrob(set_metadata_plots[[i]]))
grid.draw(arrangeGrob(set_metadata_plots[[i]], name = "metadata"))
popViewport()
}
}
if((is.null(legend) == F) && (q_legend == tolower("bottom"))){
vp = vplayout(custom_top:(custom_bottom - 5), 1:matrix_and_mainbar_right)
pushViewport(vp)
grid.draw(do.call(arrangeGrob, c(plots, ncol = attribute_plots$ncols)))
grid.draw(do.call(arrangeGrob, c(plots, ncol = attribute_plots$ncols, name = "attribute")))
popViewport()
vp = vplayout((custom_bottom - 4):custom_bottom, 1:matrix_and_mainbar_right)
pushViewport(vp)
grid.draw(arrangeGrob(legend))
grid.draw(arrangeGrob(legend, name = "legend"))
popViewport()
}
else if((is.null(legend) == F) && (q_legend == tolower("top"))){
vp = vplayout(custom_top:custom_bottom, 1:matrix_and_mainbar_right)
pushViewport(vp)
grid.draw(do.call(arrangeGrob, c(plots, ncol = attribute_plots$ncols)))
grid.draw(do.call(arrangeGrob, c(plots, ncol = attribute_plots$ncols, name = "attribute")))
popViewport()
vp = vplayout((bar_top-5):(bar_top-1), 1:matrix_and_mainbar_right)
pushViewport(vp)
grid.draw(arrangeGrob(legend))
grid.draw(arrangeGrob(legend, name = "legend"))
popViewport()
}
else{
vp = vplayout(custom_top:custom_bottom, 1:matrix_and_mainbar_right)
pushViewport(vp)
grid.draw(do.call(arrangeGrob, c(plots, ncol = attribute_plots$ncols)))
grid.draw(do.call(arrangeGrob, c(plots, ncol = attribute_plots$ncols, name = "attribute")))
popViewport()
}
# print(attribute_plots$plot, vp = vplayout(attribute_plots$rows, attribute_plots$cols), newpage = F)
Expand Down
5 changes: 4 additions & 1 deletion R/upset.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@
#' @import stats
#' @import methods
#' @import grDevices
#' @import scales
#' @import scales
#' @importFrom grid grid.grab
#' @export
upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F, set.metadata = NULL, intersections = NULL,
matrix.color = "gray23", main.bar.color = "gray23", mainbar.y.label = "Intersection Size", mainbar.y.max = NULL,
Expand Down Expand Up @@ -260,4 +261,6 @@ upset <- function(data, nsets = 5, nintersects = 40, sets = NULL, keep.order = F
expression, att.pos, first.col, att.color, AllQueryData, attribute.plots,
legend, query.legend, BoxPlots, Set_names, set.metadata, set.metadata.plots)

# Return a gTree so plot can be assigned to a variable
invisible(grid.grab())
}
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# UpSetR [![Travis-CI Build Status](https://travis-ci.org/hms-dbmi/UpSetR.svg?branch=master)](https://travis-ci.org/hms-dbmi/UpSetR) [![](http://www.r-pkg.org/badges/version/UpSetR)](https://cran.r-project.org/package=UpSetR) [![](http://cranlogs.r-pkg.org/badges/grand-total/UpSetR)](http://cranlogs.r-pkg.org/badges/grand-total/UpSetR)

## Technique

UpSetR generates static [UpSet](http://vcg.github.io/upset/) plots. The UpSet technique visualizes set intersections in a matrix layout and introduces aggregates based on groupings and queries. The matrix layout enables the effective representation of associated data, such as the number of elements in the aggregates and intersections, as well as additional summary statistics derived from subset or element attributes.
Expand All @@ -22,6 +20,15 @@ The original technique and the interactive visualization tool implementing the a
> IEEE Transactions on Visualization and Computer Graphics (InfoVis '14), vol. 20, no. 12, pp. 1983–1992, 2014.
> doi: https://doi.org/10.1109/TVCG.2014.2346248

## THIS VERSION

This is a fork of the [main repo](https://github.com/hms-dbmi/UpSetR) and makes minor edits to allow assigning the plots to variables which can then be called later and if required incorporated into more complex figures. This is outlined in my [pull request (#100)](https://github.com/hms-dbmi/UpSetR/pull/100) but at the time of writing it has not been merged. To maintain my own code I am therefore keeping this repo.

To download this version of the code using [devtools](https://cran.r-project.org/package=devtools) you can use

```R
devtools::install_github("g-thomson/UpSetR")
```

## Sample Data

Expand Down Expand Up @@ -81,16 +88,5 @@ list(query = intersects, params = list("Noir"))))
```


## Download

Install the latest released version from CRAN

```R
install.packages("UpSetR")
```

Download the latest development code of UpSetR from GitHub using [devtools](https://cran.r-project.org/package=devtools) with

```R
devtools::install_github("hms-dbmi/UpSetR")
```
1 change: 0 additions & 1 deletion man/elements.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/fromExpression.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/fromList.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/histogram.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/intersects.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/scatter_plot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion man/upset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.