The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.


For all examples the movies data set contained in the package will be used.

library(UpSetR)
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.4.4
library(grid)
library(plyr)
movies <- read.csv(system.file("extdata", "movies.csv", package = "UpSetR"), 
    header = T, sep = ";")


attribute.plots Parameter Breakdown

The attribute.plots parameter is broken down into 3 fields: gridrows, plots, and ncols

Additional: to add a legend of the queries, use query.legend = "bottom" (see Example 2).


Example 1: Built-In Attribute Histogram

Example of how to add built-in histogram attribute plot. If main.bar.color is not specified as black, elements contained in black intersection size bars will be represented as gray in attribute plots.

upset(movies, main.bar.color = "black", queries = list(list(query = intersects, 
    params = list("Drama"), active = T)), attribute.plots = list(gridrows = 50, 
    plots = list(list(plot = histogram, x = "ReleaseDate", queries = F), list(plot = histogram, 
        x = "AvgRating", queries = T)), ncols = 2))


Example 2: Built-In Attribute Scatter Plot

Example of how to add built-in attribute scatter plot. If main.bar.color not specified as black, elements contained in black intersection size bars will be represented as gray in attribute plots.

notice the use of query.legend

upset(movies, main.bar.color = "black", queries = list(list(query = intersects, 
    params = list("Drama"), color = "red", active = F), list(query = intersects, 
    params = list("Action", "Drama"), active = T), list(query = intersects, 
    params = list("Drama", "Comedy", "Action"), color = "orange", active = T)), 
    attribute.plots = list(gridrows = 45, plots = list(list(plot = scatter_plot, 
        x = "ReleaseDate", y = "AvgRating", queries = T), list(plot = scatter_plot, 
        x = "AvgRating", y = "Watches", queries = F)), ncols = 2), query.legend = "bottom")


Example 3: Creating a Custom Attribute Plot

Contents of aes_string() along with the scale_color_identity() function are required to pass in aesthetics and to make sure the correct colors are applied. A plot.margin of c(0.5,0,0,1) is recommended.

myplot <- function(mydata, x, y) {
    plot <- (ggplot(data = mydata, aes_string(x = x, y = y, colour = "color")) + 
        geom_point() + scale_color_identity() + theme(plot.margin = unit(c(0, 
        0, 0, 0), "cm")))
}

another.plot <- function(data, x, y) {
    data$decades <- round_any(as.integer(unlist(data[y])), 10, ceiling)
    data <- data[which(data$decades >= 1970), ]
    myplot <- (ggplot(data, aes_string(x = x)) + geom_density(aes(fill = factor(decades)), 
        alpha = 0.4) + theme(plot.margin = unit(c(0, 0, 0, 0), "cm"), legend.key.size = unit(0.4, 
        "cm")))
}

Example of applying the myplot custom attribute plot defined above to the data.

upset(movies, main.bar.color = "black", queries = list(list(query = intersects, 
    params = list("Drama"), color = "red", active = F), list(query = intersects, 
    params = list("Action", "Drama"), active = T), list(query = intersects, 
    params = list("Drama", "Comedy", "Action"), color = "orange", active = T)), 
    attribute.plots = list(gridrows = 45, plots = list(list(plot = myplot, x = "ReleaseDate", 
        y = "AvgRating", queries = T), list(plot = another.plot, x = "AvgRating", 
        y = "ReleaseDate", queries = F)), ncols = 2))


Example 4: Applying Everything at Once

Combining the built-in scatter plot and histogram plot with the myplot custom plot defined in the example above.

upset(movies, main.bar.color = "black", mb.ratio = c(0.5, 0.5), queries = list(list(query = intersects, 
    params = list("Drama"), color = "red", active = F), list(query = intersects, 
    params = list("Action", "Drama"), active = T), list(query = intersects, 
    params = list("Drama", "Comedy", "Action"), color = "orange", active = T)), 
    attribute.plots = list(gridrows = 50, plots = list(list(plot = histogram, 
        x = "ReleaseDate", queries = F), list(plot = scatter_plot, x = "ReleaseDate", 
        y = "AvgRating", queries = T), list(plot = myplot, x = "AvgRating", 
        y = "Watches", queries = F)), ncols = 3))


Example 5: Intersection Box Plots

Box plots that show the distribution of an attribute across all intersections. Can display a maximum of two box plot summaries at once. The boxplot.summary parameter takes a vector of one or two attribute names.

upset(movies, boxplot.summary = c("AvgRating", "ReleaseDate"))

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.