Question: Making UpSetR plot with title
3
gravatar for jsneaththompson
13 months ago by
jsneaththompson60 wrote:

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?

plot upsetr R • 1.1k views
ADD COMMENTlink modified 6 months ago by scott.lohr10 • written 13 months ago by jsneaththompson60
1

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)

ADD REPLYlink written 13 months ago by venu5.7k

It looks like you're right, I'll have to add the title after with some other method

ADD REPLYlink written 13 months ago by jsneaththompson60

Have you tried adding the usual R-option for a title in plot functions? --> main="acb"

ADD REPLYlink written 13 months ago by Wietje170

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

ADD REPLYlink written 13 months ago by jsneaththompson60

Related GitHub issue:

ADD REPLYlink written 7 weeks ago by zx87546.1k
3
gravatar for dariober
13 months ago by
dariober9.8k
Glasgow - UK
dariober9.8k wrote:

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.

ADD COMMENTlink modified 13 months ago • written 13 months ago by dariober9.8k

I ended up going with a half-baked solution, although I used GIMP so I could match the font in the UpSetR plot to the title.

ADD REPLYlink written 13 months ago by jsneaththompson60

Hi- Glad you found a solution, but see my edit to set font.

ADD REPLYlink written 13 months ago by dariober9.8k

+1. I use convert mostly to conver PDF to HQ PNG format. This is completely new to me. Thanks.

ADD REPLYlink written 13 months ago by venu5.7k

Yes... ImageMagick is quite a universe in itself, I just know the bare surface of it!

ADD REPLYlink written 13 months ago by dariober9.8k
1
gravatar for scott.lohr
6 months ago by
scott.lohr10
scott.lohr10 wrote:

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
)
ADD COMMENTlink written 6 months ago by scott.lohr10
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1420 users visited in the last hour