I'm using UpSetR to create UpSet diagrams like this, but I can't find a way to add a main title to the plot. Does anyone know if this functionality is possible in the UpSetR package at the moment?
I'm using UpSetR to create UpSet diagrams like this, but I can't find a way to add a main title to the plot. Does anyone know if this functionality is possible in the UpSetR package at the moment?
Half-baked solution is to add the title to the image itself using the convert tool part of the ImageMagick suite. At least you can do it programmatically. For example:
convert -gravity North -annotate +0+0 'My Title' -pointsize 20 input.png output.png
This will add the text "My Title" on the upper side of the image (-gravity North
) right in the middle. It can handle several image formats in input and output. ImageMagick is useful suite to have anyway...
EDIT
To choose a font just add the option -font
, for example -font TimesNewRoman
. To see available fonts you can use convert -list type
.
using this idea as a starting point: https://github.com/hms-dbmi/UpSetR/issues/63#issuecomment-306610220
you could try the following:
library(UpSetR)
movies <- read.csv(
system.file("extdata", "movies.csv", package = "UpSetR"),
header = T, sep = ";"
)
upset(
movies, nsets = 6, number.angles = 30, point.size = 3.5, line.size = 2,
mainbar.y.label = "Genre Intersections", sets.x.label = "Movies Per Genre",
text.scale = c(1.3, 1.3, 1, 1, 2, 0.75)
)
grid.edit('arrange', name="movies")
vp <- grid.grab()
grid.arrange(
grobs = list(
vp
),
top="Choosing the Top Largest Sets and Plot Formatting",
cols=1
)
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
From their reference manual here, it seems there is no argument to add a
title
to the plot. (you can check one more time just in case if I missed it)It looks like you're right, I'll have to add the title after with some other method
Have you tried adding the usual R-option for a title in plot functions? --> main="acb"
Unfortunately that doesn't work. UpSetR has options for main.bar.color, mainbar.y.label, and mainbar.y.max, so calling main results in
Error in upset(...) argument 7 matches multiple formal arguments
Related GitHub issue: