admin管理员组

文章数量:1122832

I am now getting to grips with ComplexUpset and finding it very useful. I have a dataset I am applying it to which creates an excellent UpSet chart - very clear to those who need to use it. I cannot share that data, so I will have to speak in terms of the "movies" dataset. At each time this is required, there may be different sets of genres (e.g. 1997 may only have comedy, action and animation, 1998 may have comedy, action, animation, romance and drama). I currently have my timepoint set up so the sets are manually-coloured, but I would like to automate it if possible. I currently have the format:

upset(
  movies,
  colnames(movies)[18:20],
  name='genre',
  width_ratio=0.1,
  matrix=(
    intersection_matrix(geom=geom_point(shape='circle filled', size=3))
  ),
  queries=list(
    upset_query(set='Action', fill='red'),
    upset_query(set='Animation', fill='blue'),
    upset_query(set='Comedy', fill='yellow')
  )
)

If the number and types of genres are changeable, then I will run into problems at other timepoints. So, rather than manually colouring them, is it possible to allow R to just choose from a colour scale? In my script, the UpSet "intersect" is controlled by colnames(), so that should always be correct to what I am analysing.

I have done similar with the vertical bars to differentiate the number of intersections (section below)

base_annotations=list(
         'Intersection size'=intersection_size(
           mapping=aes(fill=`Groups Count`)
         ) +
           scale_fill_brewer(palette = "Set2") + 
           theme(legend.position = "right",
                 legend.title = element_text(size = 8,
                                             family = "Trebuchet MS"),
                 element_text(family="Trebuchet MS"))

Can I apply something like scale_fill_brewer() to the horizontal bars and the circular intersection points?

本文标签: rComplexUpsetAssign any colour palette to sets and intersectionsStack Overflow